After trying every fix in the course/google, still can't fix OmniSharp Error

“Could not locate MSBuild instance to register with OmniSharp.”

Would love any help on how I can figure out why this is happening and how to fix it.

Thanks!

Hi OmerLev,

Please follow the instruction on this website and make sure all required extensions are installed: https://code.visualstudio.com/docs/other/unity

If the issue persists, please check the console of VS Code (not Unity!). If the .NET Framework 4.7.1 (Developer Pack) is mentioned there, download and install it from the official Microsoft. Here is the link: https://dotnet.microsoft.com/download/dotnet-framework/net471

Depending on your version of Unity, it might be that you will have to install the “Visual Studio Code Editor” package in Window > Package Manager in Unity.

  1. Press Ctrl + Shift + P in VS Code.
  2. Type “OmniSharp: Select Project” and press Return.
  3. Select the solution workspace entry.

Maybe you’ll have to reboot your computer. Then launch Unity again and open one of your scripts.

Did this help?


See also:

Hello Nina,

Thanks for the quick response, however I have done all of these steps, and then double checked everything and the issue persists

Install and use Visual Studio (Community Edition). For some students, VS Code simply does not work well. Maybe due to a problem with Unity, some update or whatever.

  1. Download VS and follow this instruction.
  2. Select VS as your External Script Editor in Unity (Edit > Preferences > External Tools).
  3. Install the “Visual Studio Editor” package in the Package Manager.

That should work.

Or do you need VS Code for some reason? If so, please copy and paste the messages from your console (VS Code) here.

Since the course I’m taking uses VS Code I’d rather use it (I’m also more familiar with it) but if I won’t be able to fix it I’ll try VS.

Here is the messege I get:

Starting OmniSharp server at 23.5.2022, 15:56:57

Target: c:\Users\omerh\VirusDelivery\VirusDelivery.sln

OmniSharp server started.

Path: c:\Users\omerh\.vscode\extensions\ms-dotnettools.csharp-1.24.4-win32-x64\.omnisharp\1.38.3-beta.87\OmniSharp.exe

PID: 12812
    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
    Using the 'dotnet' on the PATH.
    DotNetPath set to dotnet
    Located 0 MSBuild instance(s)

Could not locate MSBuild instance to register with OmniSharp.

Have you already tried this?

yes, I did and multiple times sadly

What operating system do you use?

If it is Windows, uninstall and reinstall the .NET Framework 4.7.1 (Developer Pack). Make sure it is exactly this version, not 4.8.

On Mac and Linux, you need the latest MONO framework.

In Edit > Preferences (in Unity), you could try to click “Regenerate project files”. Maybe that’ll solve the problem.

I use Windows, and I am using .NET Developer pack 4.7.1
I have also tried regenerating project files

After reinstalling developer pack, I did this again and it seemed to work,
however there are still some errors:

    Update project: Unity.VisualScripting.Shared.Editor

Received response for /completion but could not find request.

Received response for /completion but could not find request.

Received response for /completion but could not find request.

Received response for /completion but could not find request.

fail: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService

    Cannot call completion/resolve before calling completion!

Received response for /completion/resolve but could not find request.

Received response for /completion/resolve but could not find request.

Received response for /completion/resolve but could not find request.

Received response for /v2/getcodeactions but could not find request.

Received response for /v2/getcodeactions but could not find request.

Received response for /v2/getcodeactions but could not find request.

Received response for /v2/getcodeactions but could not find request.

Received response for /v2/getcodeactions but could not find request.

Received response for /v2/getcodeactions but could not find request.

warn: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService

    No symbol found. File: c:\Users\omerh\VirusDelivery\Assets\Driver.cs, Line: 9, Column: 26.

Received response for /v2/getcodeactions but could not find request.

Maybe the remaining error messages are caused by a package that we do not use in this course. In Unity, go to Window > Package Manager, look for the “Visual Scripting” package (or something that sounds similar) and uninstall it.

Everything looks good now!
Thanks for all the help

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms