Search code examples
c#asp.net.net.net-4.8

No relevant source lines - Source file could not be opened ('Unspecified error ')


I am running a 32-bit ASP.NET application using .NET Framework 4.8. I am getting the following error when starting the application:

error CS1504: Source file 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\...\xxx.cs' could not be opened ('Unspecified error ')

What I have tried

  • Running the application in IISExpress and Local IIS both in 32-bit mode.
  • Updating Visual Studio
  • Rebooting
  • Reinstalling Visual Studio 2022 and .NET Framework 4.8
  • Move the location of the temporary files folder to a different location using configuration
  • Remove the Temp folder/files / clean / rebuild

Solution

  • I found out what the issue was. There were language features that needed to be installed through Visual Studio 2022.

    Go to Build => ASP.NET Compilation => Enable latest C# and VB language features

    enter image description here