8

Omnisharp in VS Code produces a lot of warnings about a Unity project. Why?

When I open a script in VS Code from a Unity Editor here is what I see:

enter image description here

The Omnisharp produces warning. Here are a few of them:

[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Timeline.Editor.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.TextMeshPro.Editor.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'UnityEngine.UI.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Timeline.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
...
[warn]: OmniSharp.MSBuild.ProjectManager
        Expected project reference c:\Projects\Unity\Combo Bombo\Unity.2D.Sprite.Editor.csproj to be already loaded for project Assembly-CSharp
[warn]: OmniSharp.MSBuild.ProjectManager
        Expected project reference c:\Projects\Unity\Combo Bombo\Unity.2D.Tilemap.Editor.csproj to be already loaded for project Assembly-CSharp
[warn]: OmniSharp.MSBuild.ProjectManager
        Expected project reference c:\Projects\Unity\Combo Bombo\Unity.TextMeshPro.csproj to be already loaded for project Assembly-CSharp
[warn]: OmniSharp.MSBuild.ProjectManager
        Expected project reference c:\Projects\Unity\Combo Bombo\UnityEditor.UI.csproj to be already loaded for project Assembly-CSharp

Does anyone know why the warnings happen and how could I fix them?

I am not sure what else should I provide for a successful diagnose of the issue. So, could you, please, ask in comments in case I have to tell something else about the issue for a successful diagnose.

I have the 1.42.1 VS Code version:

enter image description here

qqqqqqq
  • 1,831
  • 1
  • 18
  • 48

4 Answers4

6

This issue has also been solved in 1.2.0. Just update your vs code package to this version via the package manager. Then regenerate your project files by navigating to Edit -> Preferences -> Regenerate Project Files. Reopening a .cs file should then solve your problem.

  • Confirmed, this is working for me with 1.2.0, which is current latest (April 2020) – Scott Hather Apr 13 '20 at 09:18
  • The problem is persisting on Mac os, I'm at version 1.44.2, any ideas? – Miguel Stevens Apr 23 '20 at 05:18
  • "Edit -> Preferences -> Regenerate Project Files" was really helpful for me in the frustrating scenario that some of my classes were failing to be referenced, many thanks for posting! – Jez May 10 '20 at 15:07
5

This warnings is a known Visual Studio Code Editor 1.1.4 bug, you can ignore it. For me, downgrading to version 1.1.3 of the package fixed the problems.

enter image description here

Hamid Yusifli
  • 9,688
  • 2
  • 24
  • 48
  • Maybe you happen to know the downgrade process for the VS Code? The process is referenced in the linked question. Also, I actually have not the `1.1.4` version. I will update my question. – qqqqqqq Feb 22 '20 at 19:04
  • 1
    @qqqqqqq [Visual Studio Code Editor 1.1.4](https://i.stack.imgur.com/OwqV8.png) is a unity package, not the actual program. – Hamid Yusifli Feb 22 '20 at 19:14
3

If you downgrade to 1.1.3 and right after upgrade to 1.2.0 your problem should be fixed!

Inacio Schweller
  • 1,986
  • 12
  • 22
WilliamLv
  • 31
  • 3
-1

The fix that worked for me was closing VS Code, ticking "Generate all .csproj files" under Edit > Preferences > External tools, then going ti Assets > Open C# Project.

Additionally, in VS Code, make sure that .csproj and .sln file extensions aren't excluded under Edit > User (tab) > Text Editor > Files > Files: Exclude.

Dan Pavlov
  • 149
  • 5