Search code examples
c#.net-corevisual-studio-codeomnisharp

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


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.


Solution

  • 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).