'Intellisense not working in VSCode - OmniSharp Error

Intellisense has stopped working for me and whenever I run VSCode this error comes up in the OmniSharp Log.

[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/leogaunt/Documents/Programming/Unity/Cube Stack/Assembly-CSharp.csproj'.
/Users/leogaunt/Documents/Programming/Unity/Cube Stack/Assembly-CSharp.csproj
/Users/leogaunt/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1178,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/leogaunt/Documents/Programming/Unity/Cube Stack/Assembly-CSharp.csproj

I have tried re-installing the plugin, and re-intsalling VSCode but it hasn't worked.

I know I have .NET Core installed as I am a Mac user and I know this because when I type dotnet --version in terminal it outputs:

3.1.401

I am programming in Unity and am creating a game for iOS.



Solution 1:[1]

Change the mono path to always, in C# extension config.

Solution 2:[2]

Trust me it'll work, tried everything and then came to this

  1. Go into VS code Preferences
  2. Search for omnisharp.path and click on edit in settings.json
  3. Add/edit line "omnisharp.path": "latest" (remember to add a comma at the end of the previous line)
  4. Go back into settings and search omnisharp, scroll down till you find Use Global Mono, change that to Always
  5. After this you will have to download Mono, mac's mono download link is this https://www.mono-project.com/download/stable/#download-mac
  6. After the download finishes, set it up by opening the download file
  7. Go back to settings.json and add mono's /bin path as "omnisharp.monoPath": "/Library/Frameworks/Mono.framework/Versions/6.12.0/bin" which is the default download path for mac, if you wanna confirm this, go into mac's disk space and then follow the above mentioned path)
  8. Finally restart VS Code and it should work (in case it still doesn't, restart it again)

Solution 3:[3]

I had the same Problem after fetching Unity from a git repository. For me it worked to reset the .Net Version in Unity. Edit -> Project Settings -> Api Compatibility Level

Switched that back and forth, restarted VSCode. The .csproj-file will file out all the missing dlls.

Solution 4:[4]

I solved this by uninstalling all SDK's and installed the older 4.7.1, then everything worked instantly.

Solution 5:[5]

I had the same problem. Here's how I fixed it:

I added all projects to the solution file (dotnet sln add <project name>) and opened the project in vs code by passing the path to vscode from terminal (code <project path>).

Solution 6:[6]

The error says that OmniSharp is looking for Version=v4.7.1. You may want to install the latest version of it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Leo Gaunt
Solution 2 Madhav Arora
Solution 3 Alexis Peters
Solution 4 Koffe
Solution 5 Mohsen
Solution 6 Yern