VSCode suddenly not working correctly - "Unable to resolve assembly"

Hi folks,
today VSCode suddenly started to throw errors when OmniSharp is loading. Auto-formatting is not working anymore, also there is no indicator on a tab if the file has unsaved changes. When loading, Omnisharp is complaining about not being able to resolve some assemblies. There are actually no files at the locations where OmniSharp is looking for them:

[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Assembly-CSharp-firstpass.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\FullscreenEditor.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Sirenix.OdinInspector.CompatibilityLayer.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Sirenix.OdinInspector.CompatibilityLayer.Editor.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Sirenix.OdinValidator.dll'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Assembly-CSharp-firstpass
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\FullscreenEditor.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Sirenix.OdinInspector.CompatibilityLayer.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Sirenix.OdinInspector.CompatibilityLayer.Editor.dll'
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly 'c:\Projects\WickedLands\Temp\bin\Debug\Sirenix.OdinValidator.dll'

I did not change any settings in Unity but only fixed some bugs and added some a few new scripts. I’m on 1.1.3 of the Visual Studio Code Editor package as 1.1.4 does not seem to work as well (see here ). I deleted the cs project files and restarted Unity, reinstalled the VSCode C# extension, reverted my changes that I did, switched the API compatibility level to 4.x and back, switched between different versions of the Visual Studio Code Editor package, updated to the latest release of OmniSharp (as suggested here ), sacrificed some cookies to the god of game development while jumping on one leg, but no combination of these (and some more) things did help.

Any help is greatly appreciated!

3 Likes

Same issue here!

I’m experiencing the same issue.

1 Like

Same issue

1 Like

It’s due to the C# (omnisharp) package being renamed. Here’s the solution: PSA: If your VS Code C# extension stopped working...

1 Like

benjamminlaner’s workaround worked for me. Thanks!

Be sure to disable extension auto-updating after you revert your version.

1 Like

If you’re still having issue with this check my post in the workaround thread: PSA: If your VS Code C# extension stopped working... page-2#post-5657998

Update: The below sure did get rid of the “could not resolve” errors but it led to more problems that ultimately didn’t solve the issue. :frowning:

The workaround mentioned here didn’t work for me as of today, May 2020. The version of the extension is now well-beyond the problematic version described in the workaround and the issue still resurfaces now and then for me.

It turns out that for me the problem was that OmniSharp looks into the path {PROJECT}\Temp\UnityVS_bin\Debug in order to locate the assemblies but for whatever reason they became empty. To solve this, I opened the project solution in regular Visual Studio (I used VS Express 2017) and rebuilt the solution (you might not need to do the rebuild). This caused a whole bunch of files (including assemblies) to be created in {PROJECT}\Temp\bin\Debug. I simply copied all of this to {PROJECT}\Temp\UnityVS_bin\Debug, then I reloaded the workspace in VS Code (CTRL + SHIFT + P, then type Reload and select “Developer: Reload Window”), and everything worked fine for me!

1 Like