VSCode "you must add a reference to assembly 'netstandard'" but compiles fine

1k views Asked by At

I don't restart my computer often, and did this morning. When VSCode launched, it looks like it did an update and now the IDE is complaining about errors.

My application still compiles and runs fine, but in the IDE, I see 30k errors all saying something similar to the following:

'The type XXXXXX is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [MyApp.Application]'

It looks like omnisharp is at the latest.

I am on a Mac as well.

2

There are 2 answers

0
Akif On BEST ANSWER

Thanks to @Martin Ullrich and for a good question to @Chris Kooken. I think it should be an approved answer in here for the next visitors to the page.

Following these steps helped me to solve the issue:

 * Go to the VSCode settings (File > Preferences > Settings).
 * Search with the keywords omnisharp use global mono to locate the configuration.
 * Change the value to never from either auto or always.
 * REMEMBER to restart the VSCode to activate the change (I restarted it twice to be sure).
0
Kia Kaha On

I didn't find the above mentioned setting in my vscode but what solved the same issue for me was enabling the following option: Use Modern Net

enter image description here

This makes sense since the error started appearing after upgrading the projects version from .NET Core 3 to .NET 7