Issue with upgrading project to Visual Studio 2019

Viewed 718

I upgraded existing web forms app (c#) from Visual Studio 2017 Enterprise to 2019. While code is working fine, when I open default.aspx page - I get 123 errors (while code compiles fine). If I open it back in 2017 version - no errors

I had addressed couple of the errors but not sure what to do with the rest. Especially puzzling that code compiles with 0 errors. Errors show only if I open default.aspx

Most errors are CS0103 - the name 'name here' doesn't exist in the current context Few errors CS0400 - the type or namespace 'project name' could not be found in the global namespace Few CS1061 - 'default_aspx' doesn't contain definition for 'Context'...

I don't understand how it still compiles without errors and works? What changed with upgrade that those errors popped up? All those names and namespaces exist and there were no changes other than upgrade. New requirements? How to fix it?

2 Answers

Found a solution:

This is happening to projects that are using v1.0.0 of Microsoft.Net.Compilers. To work around this problem you need to update to the latest stable version which is 3.0.0.

All errors disappeared.

Looks like something broken with VS Intellisense since the compile and build sueeccded.

1.Before you open the web form project in VS2019, navigate to its Solution Directory and delete the hidden .vs folder there, after that open the project in VS2019 to check if it helps.

2.If the issue persists, try cleaning the VS component cache after close all VS instance:

Go C:\Users\xxx\AppData\Local\Microsoft\VisualStudio directory, you can find many 15.xx and 16.xx folders there, feel free to delete all ComponentModelCache folders in them and restart VS.

Related