I'm working on a simple ASP.NET MVC app. Originally, I started using .NET Framework 4.7.2, but then I discovered that the web server this app will eventually use doesn't support .NET Framework 4.7.2. (It was an irritating discovery as most of our web servers do support .NET Framework 4.7.2.) That server does support .NET Framework 4.6.2, so I downgraded the project to .NET Framework 4.6.2.
However, when looking at the _Layout.cshtml page in VS 2019, there's 56 errors such as CS0234 ('Net' does not exist in the namespace 'System'), CS0518 ('System.Void' is not defined), CS0012 (type 'Object' is defined in an assembly that is not referenced), etc. All of these are coming from a project named 2_Views_Shared_Layout.csthml, which I presume is an intermediate file created by VS 2019 when building the app.
I've created cleaning the solution, then performing a rebuild of the solution. That didn't help, the errors all returned.
The app does run, as far as I can tell, fine. At least it runs fine when I debug it using VS 2019.
But I'd like to remove those errors. I'm guessing that they're caused because I originally started the project as a .NET Framework 4.7.2, then had to downgrade it to .NET Framework 4.6.2. Am I correct about that?
In any case how do I get rid of those errors?