-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get OmniSharp working in VS Code: "Could not load SDK Resolver." #1311
Comments
I'm not certain whether this issue belongs here or should be opened at VSCode extension's github. |
It's correct to put this here. Could you provide your full OmniSharp log? |
I encounter the same problem
And below is my csproj file <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.3"/>
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.2"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1"/>
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.3"/>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1"/>
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project> |
@lixiaoqiang: Unfortunately, that is not the same issue. The exception is quite different. Could you file a separate issue? |
@DustinCampbell Sure, here goes full output from OmniSharp:
Hope it would help. |
I suspect this is an issue with the VS Build Tools not including the new NuGetSdkResolver correctly. It looks like an install issue to me. Pinging @rainersigwald or @AndyGerlicher in case they know more. In the meantime, does this project build at the command line with MSBuild (not |
@quixoticaxis Do you have the ".NET Core build tools" workload installed? If not, run the Visual Studio installer and try checking this: |
@quixoticaxis sure, I've open a new issue #1313 ,Thanks for your reply |
@rainersigwald after installing ".Net Core build tools" everything works. Just in case, is it mentioned somewhere that build tools are needed? |
This is an interesting case. OmniSharp prefers to use an installed MSBuild if there is one, which helps it match the behavior of command-line MSBuild or Visual Studio. In your case, there is an installed MSBuild, but it only has the infrastructure required to build C++ projects. You're trying to open a C# project that wouldn't build from command line MSBuild.exe (for this particular comparison, MSBuild.exe and |
I'm not certain if it can help, but it could be possible to check |
@rainersigwald : That's correct. OmniSharp does check for the presence of the C# Compiler package in the VS installer (https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Host/MSBuild/Discovery/Providers/VisualStudioInstanceProvider.cs#L57), but there's no good way it could really know that the .NET Core Build Tools would be required for a particular project. |
@rainersigwald : I'm also curious about the particular exception that occurred: 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 It seems like the installer is laying down the manifest file for the NuGetSdkResolver even when it doesn't lay down the appropriate binaries? |
@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: dotnet/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. |
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. |
Having the same problem. |
Isn't there a way to select a specific MS Build instance or change the preference? |
@rainersigwald Thanks a lot!! it worked for me :) |
Had the same issue, confirming that installing the .NET build tools from Visual Studio Installer fixed this for me as well |
@fvanrysselberghe unfortunately, those options don't exist but they're tracked by #1186. |
Installing ".NET Core build tools" as described, did help me, too. |
How to Install .net Build Tools in VS Code |
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? |
@hmobius You should be able to add the "`.NET Core build tools" workload in your installed Visual Studio Build Tools (which had the C++ workload) to resolve the problem. The issue isn't that the build tools installer removed something, but that once the build-tools MSBuild environment is found, it is used, even if it doesn't include all the workloads you need. |
@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. |
@hmobius You're saying that you had the .NET Core Build Tools workload installed in build tools as in #1311 (comment), and still saw this exact problem? Note that installing that workload is different from reinstalling the .NET Core SDK, which is what you mentioned doing in your post--the workload applies only to the Build Tools instance of "Visual Studio", while the SDK is an MSI that makes |
@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. |
I'm having the same issue:
points to the SDK resolver at
but
does not contain a Nuget folder. At this point in time the installer says the only components that are installed are:
I find it strange because I never would have installed any C++ tooling intentionally. After installing the .NET Core Build Tools I had the NuGet folder and everything worked fine. |
I had installed VS build tools for Windows development with Rust and I was getting the same error. Uninstalling the build tools resolved the issue. |
Can you try installing .Net Core Build Tools as described |
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.
A Google-fu suggests that this issue looks like a symptom of #1094. |
If anyone doesn't want to uninstall build tools, follow suggestion in following post: |
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 : #1094 |
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. |
Worked for me installing the .Net Core Build Tools. Can be installed with chocolatey
|
Installing .NET Core Build Tools via the Visual Studio Installer fixed the issue for me! |
This resolved my issues too. |
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. |
Just like @neoKushan said my omnisharp break after install the "windows-build-tools" with node. |
Same issue with VS Code on Fedora 29. It was working fine earlier today until dotnet-core was updated with |
I too am having the same issue on Fedora 29. |
This fixed my issue: #1394 (comment) |
I came here because I got the same problem in Ubuntu 20.04. To resolve it I had to uninstall .net core, clean the apt cache and install the .net core. |
For .NET 6.0: Install Visual Studio Build tools 2022, then install .NET SDK from |
For Unity users -- I had to delete my sln / csproj files and then regenerate them under |
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).
The text was updated successfully, but these errors were encountered: