I found that the direct cause for the error in my case was:
this makes sense since the error is stating that there is an invalid option for language.
but, this was working fine before - so it must've been selected. what changed? turns out a member on my team upgraded to vs 2017, while i was still using 2015. after he made changes to the project, the language version was changed and i received that change over source control. but the version selected was not available to my version of vs, so it was blank - hence the error. after selecting a value in the language drop down (i chose default), a new error popped up. the new error was causing a build failure on any lines of code which used the newer version of c#. i changed the code to perform the same functions, but with my c# version syntax and problem solved.
so while the direct cause of the error was indeed an invalid selection of Language Version, the root cause was due to different vs/c# versions conflicting.
Turns out this was a problem, because the ASP.NET MVC 4 project was referencing a specific version of the Microsoft.Net.Compilers package. Visual Studio was using the compiler from this specific package, and not the compiler that was installed otherwise on the computer.
A warning or something would have been nice from VS2019 :-)
The solution then is to update the Microsoft.Net.Compilers package to a newer version.
Version 1.x is for C# 6
Version 2.x is for C# 7
Version 3.x is for C# 8
How I got to solve this was not immediately obvious. Visual Studio could have suggested or hinted that by me selecting a new version in the project settings that setting now conflicted with the package installed into the project.
(I ended up turning on Diagnostics level MSBuild logging to find out which CSC.EXE the IDE is really trying to use)
Clean Solution and Build again
In my case, whatever the previous settings were blocking due to mismatch. I imported a new project and build it, tried changing versions and all.
clean the solutions and build worked for me.
The solution was quite easy, as I used .Net Framework 4.6.1, but the project begged me in the beginning to use 4.6.2. Although I downloaded it, it was first actively chosen, when restartet all instances of Visual Studion (or better close all instances). The project was manipulated to 4.6.1 (although I wished not and chose so).
So after I chose the configuration again to choose .Net Framework 4.6.1 the error vanished immediately.
After upgrading this NuGet package to 3.6.0 the error still persisted in my web application.
Solution
I found out that I had to delete an old "bin\Roslyn" folder in my Web Application to make this work.
It seems that the newer Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package (3.6.0 in my case) does not bring a its own "Rosyln" folder anymore, and if present, that old "Roslyn" folder took precedence during compilation.
This happened to me when I pulled down my repo after moving it to a new location. The solution was to unload and then reload each project that was showing this error.
I tried a few other options but nothing worked for me. Also in this situation my config files were set to use languageversion 6, so setting them to default did not fix the issue.
If above all options are not working and you have used nuget packages like Microsoft.Net.Compilers and CodeDom and still not working then there is issue with your project file open project file. Project file is using one of the compiler option which not support your selected language. Open project file with notepad++ and remove the following line.