When I make any change to a CSHTML file while debugging then reload the page, I get this exception. This used to work, and I'm not aware of any changes that could affect this. Googling this error message hasn't been helpful either. Any direction is very much appreciated.
I have tried all the suggestions in https://stackoverflow.com/a/27672935/3397630 without any luck.
I am currently using Visual Studio Community 2022 and .NET 5, but this same thing was happening with 2019.
An unhandled exception occurred while processing the request.
MissingMethodException: Method not found: 'Void Microsoft.CodeAnalysis.CompilationOptions.set_ReferencesSupersedeLowerVersions_internal_protected_set(Boolean)'.
Microsoft.CodeAnalysis.CSharp.CSharpCompilationOptions.WithReferencesSupersedeLowerVersions(bool value)
TypeInitializationException: The type initializer for 'Microsoft.CodeAnalysis.CSharp.CSharpCompilation' threw an exception.
Microsoft.CodeAnalysis.Razor.CompilationTagHelperFeature.GetDescriptors()