It was giving me the same error as this post shows. I tried every solution in the post. I am working with .NET Framework 4.5 in VS2019.
Here is my Web.config file:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701">
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" />
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+">
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="OptionInfer" value="true" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
I also added <LangVersion>Default</LangVersion> in the .csproj file.
The error then appeared in the browser instead of the error list in VS2019.
Before I did this it said that it did not accept preview as a language version and should change it to ISO-1, ISO-2 or a number between 1 to 6 or Default.
Also the option for selecting the language version in Properties > Build > Advanced > Language version is disabled and says Automatically selected based on framework version.
The project doesn't open.