omnisharp-roslyn: Can't get OmniSharp working in VS Code: "Could not load SDK Resolver."
When I open any folder with .csproj file OmniSharp fails to load the project:
Microsoft.Build.Exceptions.InvalidProjectFileException: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found. Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml'. SDK resolver path: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll
The folder “NuGet” does not exist on my machine. I do not have VS2017 installed. I have the latest .Net SDK (2.1.403) and standalone build tools installation (that I need to compile C++ on Windows with Clang).
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 45 (14 by maintainers)
@quixoticaxis Do you have the “.NET Core build tools” workload installed? If not, run the Visual Studio installer and try checking this:
How to Install .net Build Tools in VS Code
@rainersigwald after installing “.Net Core build tools” everything works. Just in case, is it mentioned somewhere that build tools are needed?
@rainersigwald I think I may be getting confused. I had
To my recollection I didn’t notice the .NET Core option in Build Tools installer, but then I don’t believe I was looking for it. I just tried to find that in the VS Build Tools installer but can’t see an option for .NET Core anywhere - just the full framework builds.
Worked for me installing the .Net Core Build Tools. Can be installed with chocolatey
Just wanted to add a note here. I had all running fine with VS Code, .NET Core SDK 2.2 and Omnisharp. However, I had to install the Visual Studio Build Tools 2017 for a C++ compiler (that Cython could address) after which Omnisharp started reporting this error. Reinstalling the .NET Core SDK did not help without first uninstalling the Build Tools. Surely there needs to be some sort of check in the build tools install to not alter what is already on the machine?
How does one resolve this problem in Visual Studio Code? All references to a solution involve Visual Studio 2017, which I do not have and will not install. How is this resolved in Visual Studio Code?
UPDATE: Ah, nevermind! A search in my Start menu revealed a Visual Studio Installer in place. I ran it and it had the aforementioned tools. It works now.
For anyone who is hitting this issue, please try installing the .Net Core Build Tools as described here.
The MSBuild that ships with C++ Build Tools is missing some dependencies needed for OmniSharp and the correct approach is to have OmniSharp be able to provide the option to choose the MSBuild to be used. We are working on it and further details can be found here : https://github.com/OmniSharp/omnisharp-roslyn/issues/1094
Installing “.NET Core build tools” as described, did help me, too.
Yup – it would still fail, but with a different error: e.g. “Can’t find ‘Microsoft.NET.Sdk’” or something like that. I just wanted to be sure you spotted the installer issue.
@quixoticaxis from version 15.0, MSBuild no longer sets that registry key, because there can be multiple side-by-side installs of a single tools version (for example, Visual Studio release channel and Visual Studio preview channel). The replacement is to use the Visual Studio setup APIs to query what installations are available, which is what OmniSharp is doing.
Yes indeed, and that is a bug we can fix. It’ll be a coordinated change in NuGet (add the manifest: NuGet/Home#7390) and MSBuild (remove the manifest: Microsoft/msbuild#3852).
Even if that was fixed, though, we’d still fail to load the project–on a full install the .NET Core SDK resolver would find the installed .NET Core SDK, but it’s not present so we go down the list and hit the worse error experience.
Same issue with VS Code on Fedora 29. It was working fine earlier today until dotnet-core was updated with
dnf update(from official MS repo). Any ideas on how to fix it?Just for some information, Node these days will install the C++ build tools as part of its own installation. This is likely why some people are suddenly hitting this error without having changed anything to do with VS or .net.
Whether you have Visual Studio installed or not, installing or updating Node could suddenly break your environment and you’d be none the wiser.
If anyone doesn’t want to uninstall build tools, follow suggestion in following post: https://github.com/OmniSharp/omnisharp-roslyn/issues/1094#issuecomment-405414145
I ran into this issue too. After installed .Net Core build tools in Visual Studio Build Tools 2017, the issue went away. Then I tried uninstall .Net Core workload, it appeared again. The order of MSBuild instances seems to be a matter, from OmniSharp log:
A Google-fu suggests that this issue looks like a symptom of #1094.
@rainersigwald I think you misunderstood. Installing the VS Build Tools caused the problem in the first place. Even though I used that installer to try reinstalling the .NET Core Builds tools, the Omnisharp issue persisted until I uninstalled the VS Build tools in its entirety.