Home > database >  Could not locate MSBuild instance to register with OmniSharp
Could not locate MSBuild instance to register with OmniSharp

Time:03-27

I have found many questions about this but non have helped me. I am trying to write c# code and the omnisharp auto complete doesn't work and I get this back from the Omnisharp Log:

OmniSharp server started.
    Path: c:\Users\GeorgV.216\.vscode\extensions\ms-dotnettools.csharp-1.24.1\.omnisharp\1.38.3-beta.31\OmniSharp.exe
    PID: 11536

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 0 MSBuild instance(s)
Could not locate MSBuild instance to register with OmniSharp.

What could be a possible solution?

CodePudding user response:

The solution that worked for me was to change the "omnisharp.path": from "latest" to "" in the setting.json file and delete the 1.38.3-beta.31 folder in C:\Users{username}.vscode\extensions\ms-dotnettools.csharp-1.24.1.omnisharp

CodePudding user response:

Suddenly got this problem too, adding "omnisharp.useModernNet": true to the settings.json fixed it for me.

CodePudding user response:

Working for me now. Maybe the cause is (from omnisharp github): "Planned removal of the included Mono & MSBuild Tools

In the future .NET Framework builds of OmniSharp will not ship with Mono or the MSBuild tooling (See announcement omnisharp-roslyn#2339). To ensure that the C# extension remains usable out of the box for .NET SDK projects, we will be changing the default value of omnisharp.useModernNet to true."

But " omnisharp.useModernNet to true" does not work with Unity 3d.

So.

I uninstall all dotnets from ubuntu. Unistall mono. Reinstall dotnet using this: https://docs.microsoft.com/es-es/dotnet/core/install/linux-ubuntu#2110- Reinstall mono-complete using synaptics. And in VS settings set omnisharp using global mono to "always". Now it's working for me.

CodePudding user response:

The solution that worked for me:

Manage Settings search for "omnisharp path" edit in settings.json enter code here> replace "latest" with ""

  • Related