Skip to content
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

Closed
quixoticaxis opened this issue Oct 6, 2018 · 45 comments
Closed

Comments

@quixoticaxis
Copy link

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).

@quixoticaxis quixoticaxis changed the title VS Code plugin won't start: Could not load SDK Resolver Can't get OmniSharp working in VS Code: "Could not load SDK Resolver." Oct 6, 2018
@quixoticaxis quixoticaxis reopened this Oct 6, 2018
@quixoticaxis
Copy link
Author

I'm not certain whether this issue belongs here or should be opened at VSCode extension's github.

@DustinCampbell
Copy link
Contributor

It's correct to put this here. Could you provide your full OmniSharp log?

@lixiaoqiang
Copy link

lixiaoqiang commented Oct 9, 2018

I encounter the same problem
Omnisharp logs:

Starting OmniSharp server at 10/9/2018, 10:19:58 PM
    Target: d:\work\tools\XxxTransfer

OmniSharp server started.
    Path: C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\OmniSharp.exe
    PID: 22356

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild\15.0\Bin"
            CscToolExe = csc.exe
            CscToolPath = C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild\15.0\Bin\Roslyn
            MSBuildExtensionsPath = C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild
            MSBuildToolsPath = C:\Users\xiaoqiang\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'd:\work\tools\XxxTransfer'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'd:\work\tools\XxxTransfer'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'd:\work\tools\XxxTransfer\XxxTransfer.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'd:\work\tools\XxxTransfer'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'd:\work\tools\XxxTransfer' on host 21736.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: d:\work\tools\XxxTransfer\XxxTransfer.csproj
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'd:\work\tools\XxxTransfer\XxxTransfer.csproj'.
d:\work\tools\XxxTransfer\XxxTransfer.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.  d:\work\tools\XxxTransfer\XxxTransfer.csproj
   在 Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
   在 Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
   在 Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
   在 Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   在 Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   在 Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
   在 Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   在 Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
   在 Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
   在 Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
   在 Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   在 OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath)
   在 OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath)
   在 OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectLoader loader)
   在 OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader)

[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: d:\work\tools\XxxTransfer\XxxTransfer.csproj

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>

@DustinCampbell
Copy link
Contributor

@lixiaoqiang: Unfortunately, that is not the same issue. The exception is quite different. Could you file a separate issue?

@quixoticaxis
Copy link
Author

@DustinCampbell Sure, here goes full output from OmniSharp:

Starting OmniSharp server at 10/9/2018, 10:39:02 PM
    Target: g:\Projects\csharp-research\ex_0_001_fibonacci

OmniSharp server started.
    Path: C:\Users\quixo\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\OmniSharp.exe
    PID: 10780

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Visual Studio Build Tools 2017 15.8.28010.2036 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
            2: StandAlone 15.0 - "C:\Users\quixo\.vscode\extensions\ms-vscode.csharp-1.16.2\.omnisharp\1.32.5\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Build Tools 2017 15.8.28010.2036 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'g:\Projects\csharp-research\ex_0_001_fibonacci'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        No solution files found in 'g:\Projects\csharp-research\ex_0_001_fibonacci'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'g:\Projects\csharp-research\ex_0_001_fibonacci\ex_0_001_fibonacci.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'g:\Projects\csharp-research\ex_0_001_fibonacci'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'g:\Projects\csharp-research\ex_0_001_fibonacci' on host 12856.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: g:\Projects\csharp-research\ex_0_001_fibonacci\ex_0_001_fibonacci.csproj
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'g:\Projects\csharp-research\ex_0_001_fibonacci\ex_0_001_fibonacci.csproj'.
g:\Projects\csharp-research\ex_0_001_fibonacci\ex_0_001_fibonacci.csproj(1,1)
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  g:\Projects\csharp-research\ex_0_001_fibonacci\ex_0_001_fibonacci.csproj
   at Microsoft.Build.Shared.ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(Boolean condition, String errorSubCategoryResourceName, BuildEventFileInfo projectFile, Exception innerException, String resourceName, Object[] args)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.TryAddAssemblyFromManifest(String pathToManifest, String manifestFolder, List`1 assembliesList, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.FindPotentialSdkResolvers(String rootFolder, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverLoader.LoadResolvers(LoggingContext loggingContext, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.Initialize(LoggingContext loggingContext, ElementLocation location)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath)
   at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.<>c__DisplayClass3_0.<ResolveSdk>b__0(String key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Build.BackEnd.SdkResolution.CachingSdkResolverService.ResolveSdk(Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
   at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
   at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
   at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
   at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
   at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
   at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
   at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath)
   at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath)
   at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectLoader loader)
   at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader)

[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: g:\Projects\csharp-research\ex_0_001_fibonacci\ex_0_001_fibonacci.csproj

Hope it would help.

@DustinCampbell
Copy link
Contributor

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 dotnet build)?

@rainersigwald
Copy link
Contributor

@quixoticaxis Do you have the ".NET Core build tools" workload installed? If not, run the Visual Studio installer and try checking this:

image

@lixiaoqiang
Copy link

lixiaoqiang commented Oct 10, 2018

@quixoticaxis sure, I've open a new issue #1313 ,Thanks for your reply

@quixoticaxis
Copy link
Author

@rainersigwald after installing ".Net Core build tools" everything works. Just in case, is it mentioned somewhere that build tools are needed?

@rainersigwald
Copy link
Contributor

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 dotnet build are distinct), so ideally OmniSharp would fall back to its own MSBuild, rather than using the C++ Build Tools one. But I don't think there's a good way for OmniSharp to know that the copy of Build Tools that it's found isn't good enough.

@quixoticaxis
Copy link
Author

quixoticaxis commented Oct 11, 2018

I'm not certain if it can help, but it could be possible to check HKLM:\software\Microsoft\MSBuild\ToolsVersions\*** to decide what build tools are currently available? I believe that even non admin users should have read-only access to HKLM registry.

@DustinCampbell
Copy link
Contributor

DustinCampbell commented Oct 11, 2018

@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.

@DustinCampbell
Copy link
Contributor

@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?

@rainersigwald
Copy link
Contributor

@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.

It seems like the installer is laying down the manifest file for the NuGetSdkResolver even when it doesn't lay down the appropriate binaries?

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.

@DustinCampbell
Copy link
Contributor

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.

@TAGC
Copy link

TAGC commented Nov 16, 2018

Having the same problem.

@fvanrysselberghe
Copy link

Isn't there a way to select a specific MS Build instance or change the preference?

@soso-maitha
Copy link

@rainersigwald Thanks a lot!! it worked for me :)

@hessproject
Copy link

Had the same issue, confirming that installing the .NET build tools from Visual Studio Installer fixed this for me as well

@DustinCampbell
Copy link
Contributor

@fvanrysselberghe unfortunately, those options don't exist but they're tracked by #1186.

@UweKeim
Copy link

UweKeim commented Dec 23, 2018

Installing ".NET Core build tools" as described, did help me, too.

@Aditybohra9121
Copy link

How to Install .net Build Tools in VS Code

@hmobius
Copy link

hmobius commented Dec 28, 2018

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?

@rainersigwald
Copy link
Contributor

@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.

@hmobius
Copy link

hmobius commented Jan 3, 2019

@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.

@rainersigwald
Copy link
Contributor

@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 dotnet.exe available but doesn't configure Visual Studio instances.

@hmobius
Copy link

hmobius commented Jan 4, 2019

@rainersigwald I think I may be getting confused. I had

  1. installed VS Code. All fine
  2. installed VS build tools for C++ etc. Error started at this point.
  3. reinstalled the .NET Core SDK (not the .NET Core part of the VS Build Tools - apologies for confusion). Error still occuring
  4. uninstalled all VS Build Tools. All fine again.

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.

@phillijw
Copy link

I'm having the same issue:

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers...
\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml

points to the SDK resolver at

C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions...
\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll

but

C:\Program Files (x86)\Microsoft Visual Studio\2017...
\BuildTools\Common7\IDE\CommonExtensions\Microsoft\

does not contain a Nuget folder.

At this point in time the installer says the only components that are installed are:

  • Static analysis tools
  • VC++ 2017 version 15.9 v14.16 latest v141 tools
  • Visual C++ 2017 Redistributable Update
  • Visual C++ tools for CMake
  • Testing tools core features - Build Tools
  • Visual C++ Build Tools core features
  • Windows 10 SDK (10.0.17763.0)
  • Windows Universal C Runtime

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.

@jean-lourenco
Copy link

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.

@akshita31
Copy link
Contributor

Can you try installing .Net Core Build Tools as described here(#1311 (comment))

@DSakura207
Copy link

DSakura207 commented Jan 29, 2019

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:

Located 3 MSBuild instance(s)
1: Visual Studio Build Tools 2017 15.9.28307.344 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
2: Visual Studio Professional 2017 15.9.28307.344 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin"
3: StandAlone 15.0 - "C:\Users\username\.vscode\extensions\ms-vscode.csharp-1.17.1.omnisharp\1.32.8\msbuild\15.0\Bin"

A Google-fu suggests that this issue looks like a symptom of #1094.

@falaque
Copy link

falaque commented Jan 30, 2019

If anyone doesn't want to uninstall build tools, follow suggestion in following post:
#1094 (comment)

@akshita31
Copy link
Contributor

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

@jramirezqat
Copy link

jramirezqat commented Feb 1, 2019

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.

@krokofant
Copy link

Worked for me installing the .Net Core Build Tools. Can be installed with chocolatey

choco install visualstudio2017-workload-netcorebuildtools

@bestickley
Copy link

Installing .NET Core Build Tools via the Visual Studio Installer fixed the issue for me!

@boremeister
Copy link

boremeister commented Feb 28, 2019

This resolved my issues too.

@neoKushan
Copy link

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.

@nick-amorim
Copy link

Just like @neoKushan said my omnisharp break after install the "windows-build-tools" with node.
After the removal everything went back to normal.

@ccidral
Copy link

ccidral commented Apr 4, 2019

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?

@kjbetz
Copy link

kjbetz commented Apr 16, 2019

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?

I too am having the same issue on Fedora 29.

@kjbetz
Copy link

kjbetz commented Apr 16, 2019

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?

I too am having the same issue on Fedora 29.

This fixed my issue: #1394 (comment)

@DiomedesDominguez
Copy link

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.

@a3y3
Copy link

a3y3 commented Mar 25, 2022

For .NET 6.0: Install Visual Studio Build tools 2022, then install .NET SDK from Individual Components.

@thnewlands
Copy link

For Unity users -- I had to delete my sln / csproj files and then regenerate them under preferences / external tools / regenerate project files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests