dotnet --info
.NET Command Line Tools (1.0.1)
Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.1
(No Visual Studio)
VS Code version:
1.18.0
C# Extension version:
ms-vscode.csharp-1.13.0
Start OmniSharp server
(On VS Code startup or Restart OmniSharp)
OmniSharp server starts and loads all project files.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to load project file 'd:\my-proj\app-server\src\DMProg.Core\DMProg.Core.csproj'.
See OmniSharp log:
Starting OmniSharp server at 11/9/2017, 12:52:40 PM
Target: d:\my-proj\app-server
OmniSharp server started
Path: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\OmniSharp.exe
PID: 9296
[dbug]: OmniSharp.MSBuild.Discovery.Providers.VisualStudioInstanceProvider
An exception was thrown while retrieving Visual Studio instances.
System.DllNotFoundException: Unable to load DLL 'Microsoft.VisualStudio.Setup.Configuration.Native.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at OmniSharp.MSBuild.Discovery.Interop.GetSetupConfiguration(ISetupConfiguration& configuration, IntPtr reserved)
at OmniSharp.MSBuild.Discovery.Interop.GetSetupConfiguration()
at OmniSharp.MSBuild.Discovery.Providers.VisualStudioInstanceProvider.GetInstances()
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 15.0 - "D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 15.0 - "D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin"
CscToolExe = csc.exe
CscToolPath = D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Roslyn
MSBuildExtensionsPath = D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild
MSBuildToolsPath = D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Resolved 'Microsoft.Build.Framework' to 'D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Microsoft.Build.Framework.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'd:\my-proj\app-server'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
Initializing in d:\my-proj\app-server
[info]: OmniSharp.DotNet.DotNetProjectSystem
Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
Resolving projects references
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Resolved 'Microsoft.Build' to 'D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Microsoft.Build.dll'
[dbug]: OmniSharp.MSBuild.MSBuildProjectSystem
MSBuild environment:
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
MSBuildToolsDirectory64: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
MSBuildSDKsPath: C:\Program Files\dotnet\sdk\1.0.1
CurrentMSBuildConfigurationFile: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\MSBuild.exe.config
CurrentMSBuildExePath: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\MSBuild.exe
CurrentMSBuildToolsDirectory: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
VisualStudioInstallRootDirectory:
MSBuildExtensionsPath: D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
No solution files found in 'd:\my-proj\app-server'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Resolved 'Microsoft.Build' to 'D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Microsoft.Build.dll'
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Loading project: d:\my-proj\app-server\src\DMProg.Core\DMProg.Core.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
'MSBuildExtensionsPath' set to 'D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild'
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
'CscToolPath' set to 'D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Roslyn'
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
'CscToolExe' set to 'csc.exe'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to load project file 'd:\my-proj\app-server\src\DMProg.Core\DMProg.Core.csproj'.
d:\my-proj\app-server\src\DMProg.Core\DMProg.Core.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. d:\my-proj\app-server\src\DMProg.Core\DMProg.Core.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
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)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.LoadProject(String filePath, String solutionDirectory, ILogger logger, MSBuildInstance msbuildInstance, MSBuildOptions options, ICollection`1 diagnostics, ImmutableArray`1& targetFrameworks)
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create(String filePath, String solutionDirectory, ILogger logger, MSBuildInstance msbuildInstance, MSBuildOptions options, ICollection`1 diagnostics)
at OmniSharp.MSBuild.MSBuildProjectSystem.LoadProject(String projectFilePath)
Sorry I need to update my issue report.
The OmniSharp log above was produced with an environment set to an obvious wrong location.
When setting
MSBuildSDKsPath=C:\Program Files\dotnet\sdk\1.0.1\Sdks
it is working.
BUT with out any MSBuildSDKsPath being set it defaults to the non existing path
D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Sdks
and the mentioned error occurs.
So, it seems to be required to explicitly set the environment MSBuildSDKsPath (correctly) in order to get OmniSharp to run with version 1.13.0
This was not necessary with previous versions.
Thanks for the detailed information. Could you check D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\omnisharp\msbuild\15.0\Bin\ and let me know if there is an SdkResolvers folder there?
Yes, I can confirm that there is a SdkResolvers folder (containing a Microsoft.DotNet.MSBuildSdkResolver...).
Thanks! Without MSBuildSDKsPath set, could you set COREHOST_TRACE=1 and load your project is VS Code? This should add spew a bit of diagnostics in your OmniSharp Log when the SdkResolver tries to locate your SDK.
Okay, I added COREHOST_TRACE=1 and removed MSBuildSDKsPath.
When now loading the project the probing for the SDK path seems to happen after the actual project load:
Starting OmniSharp server at 11/9/2017, 4:24:32 PM
Target: D:\my-proj\DMProg\app-server
OmniSharp server started
Path:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\OmniSharp.exe
PID: 9308
[dbug]: OmniSharp.MSBuild.Discovery.Providers.VisualStudioInstanceProvider
An exception was thrown while retrieving Visual Studio instances.
System.DllNotFoundException: Unable to load DLL 'Microsoft.VisualStudio.Setup.Configuration.Native.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at OmniSharp.MSBuild.Discovery.Interop.GetSetupConfiguration(ISetupConfiguration& configuration, IntPtr reserved)
at OmniSharp.MSBuild.Discovery.Interop.GetSetupConfiguration()
at OmniSharp.MSBuild.Discovery.Providers.VisualStudioInstanceProvider.GetInstances()
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 15.0 - "D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 15.0 - "D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin"
CscToolExe = csc.exe
CscToolPath =D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Roslyn
MSBuildExtensionsPath =D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild
MSBuildToolsPath =D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Resolved 'Microsoft.Build.Framework' to 'D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Microsoft.Build.Framework.dll'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.CodeAnalysis.VisualBasic.Features, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'D:\my-proj\DMProg\app-server'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.DotNet.DotNetProjectSystem
Initializing in D:\my-proj\DMProg\app-server
[info]: OmniSharp.DotNet.DotNetProjectSystem
Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
Resolving projects references
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Resolved 'Microsoft.Build' to 'D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Microsoft.Build.dll'
[dbug]: OmniSharp.MSBuild.MSBuildProjectSystem
MSBuild environment:
Mode: Standalone
RunningTests: False
RunningInVisualStudio: False
MSBuildToolsDirectory32:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
MSBuildToolsDirectory64:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
MSBuildSDKsPath:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Sdks
CurrentMSBuildConfigurationFile:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\MSBuild.exe.config
CurrentMSBuildExePath:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\MSBuild.exe
CurrentMSBuildToolsDirectory:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
VisualStudioInstallRootDirectory:
MSBuildExtensionsPath:D:\User\cja\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
No solution files found in 'D:\my-proj\DMProg\app-server'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Resolved 'Microsoft.Build' to 'D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Microsoft.Build.dll'
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Loading project: D:\my-proj\DMProg\app-server\src\DMProg.Core\DMProg.Core.csproj
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
'MSBuildExtensionsPath' set to 'D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild'
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
'CscToolPath' set to 'D:\User\Christian Jäckel\.vscode\extensions\ms-vscode.csharp-1.13.0\.omnisharp\msbuild\15.0\Bin\Roslyn'
[dbug]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
'CscToolExe' set to 'csc.exe'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[dbug]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Attempting to resolve 'Microsoft.Build.resources, Version=15.1.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a'
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to load project file 'D:\my-proj\DMProg\app-server\src\DMProg.Core\DMProg.Core.csproj'.
D:\my-proj\DMProg\app-server\src\DMProg.Core\DMProg.Core.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. D:\my-proj\DMProg\app-server\src\DMProg.Core\DMProg.Core.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
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)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.LoadProject(String filePath, String solutionDirectory, ILogger logger, MSBuildInstance msbuildInstance, MSBuildOptions options, ICollection`1 diagnostics, ImmutableArray`1& targetFrameworks)
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create(String filePath, String solutionDirectory, ILogger logger, MSBuildInstance msbuildInstance, MSBuildOptions options, ICollection`1 diagnostics)
at OmniSharp.MSBuild.MSBuildProjectSystem.LoadProject(String projectFilePath)
Tracing enabled
--- Invoked hostfxr [commit hash: e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d] hostfxr_resolve_sdk
Probing path [D:\my-proj\DMProg\app-server\src\DMProg.Core\DMProg.Core.csproj\global.json] for global.json
Probing path [D:\my-proj\DMProg\app-server\src\DMProg.Core\global.json] for global.json
Probing path [D:\my-proj\DMProg\app-server\src\global.json] for global.json
Probing path [D:\my-proj\DMProg\app-server\global.json] for global.json
Found global.json [D:\my-proj\DMProg\app-server\global.json]
--- Resolving CLI version from global json [D:\my-proj\DMProg\app-server\global.json]
CLI version is [1.0.1] in global json file [D:\my-proj\DMProg\app-server\global.json]
Searching SDK directory in [C:\Program Files\dotnet]
CLI directory [C:\Program Files\dotnet\sdk\1.0.1] from global.json exists
Found CLI SDK in: C:\Program Files\dotnet\sdk\1.0.1
I am also seeing this with the latest vs-code on macOS, omnishap, and dotnet on a fresh classlib project
ms-vscode.csharp 1.13.0
$ code --version
1.18.0
dcee2202709a4f223185514b9275aa4229841aa7
$ dotnet --info
.NET Command Line Tools (2.0.2)
Product Information:
Version: 2.0.2
Commit SHA-1 hash: a04b4bf512
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.0.2/
Microsoft .NET Core Shared Framework Host
Version : 2.0.0
Build : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found.
@cjaeckel
When now loading the project the probing for the SDK path seems to happen after the actual project load.
I wish it were as simple as that, but I'm not sure. @nguerrera, do you know if this would even be possible?
FYI, I manually installed 1.12.1 and it worked again
@anorborg : As a workaround, you should also be able to make it work by setting the MSBuildSDKsPath environment variable to /usr/local/share/dotnet/sdk/2.0.2/Sdks.
When now loading the project the probing for the SDK path seems to happen after the actual project load.
I wish it were as simple as that, but I'm not sure. @nguerrera, do you know if this would even be possible?
From the looks of that log sequence, it seems like something evaluated the project without the resolver, then something else did it with the resolver. Are there two msbuilds involved somehow and one of them does not have the resolver?
From the looks of that log sequence, it seems like something evaluated the project without the resolver, then something else did it with the resolver. Are there two msbuilds involved somehow and one of them does not have the resolver?
It does look that way, but OmniSharp does not run MSBuild in parallel and only one MSBuild is ever used. In the OmniSharp Log above, it is using the MSBuild that is included with OmniSharp, which includes it's own copy of the SdkResolvers.
FWIW, this is starting to look like: https://github.com/Microsoft/msbuild/issues/2532.
This is also happening here: https://github.com/OmniSharp/omnisharp-vscode/issues/1846
CLI version is [1.0.1] in global json file [D:\my-proj\DMProg\app-server\global.json]
Found CLI SDK in: C:\Program Filesdotnet\sdk\1.0.1
Ah! CLI versions less than 1.0.4 had a bug where SDK to SDK imports did not use the right mechanism. This means they were fundametally broken when we introduced SDK resolution. The resolver will reject anything lower than 1.0.4.
We issue an error message for this case:
But msbuild isn't surfacing it to the user. I thought this was due to the legacy Sdks directory, but here I see it happening without that present. https://github.com/dotnet/cli/issues/6887 tracks getting this error to surface correctly.
Thanks @nguerrera! @cjaeckel : Have you considered updating your .NET Core SDK to a newer version? It sounds like that would address the problem: https://www.microsoft.com/net/download/windows. .NET Core SDK 1.0.4 is still available here, though a newer version might serve you better.
Looks like even now, I needed to create launch code with the environment variable MSBuildSDKsPath set to the proper location c:\Program Files\dotnet\sdk\2.1.302\Sdks in my case. Is this normal at this point? Or did I improperly setup dotnet so it didn't alter my path?
@omartin2010 Is dotnet not on your PATH? How did you install it?
dotnet is on my path (specifically, c:\Program Files\dotnet\ is, but c:\Program Files\dotnet\sdk\2.1.302\SDKs wasn't. Is this expected?
Is this expected?
Yes, that is normal.
I guess it’s expected from Code’s point of view, but do you know if it Iis expected that I need to _manually add_ the dotnet core’s SDK subdirectory to the path to get this to work for a project that’s built using dotnet core that is in the path? If so, that doesn’t sound right as it gets people wasting time trying to understand why intellisense doesn’t work for these libraries when it should… if the path is set properly. Unless it’s my install of the SDK that had gone wrong. Oh well..
From: Nick Guerrera notifications@github.com
Sent: Thursday, October 11, 2018 8:18:38 PM
To: OmniSharp/omnisharp-vscode
Cc: Olivier Martin; Mention
Subject: Re: [OmniSharp/omnisharp-vscode] Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. (#1849)
Is this expected?
Yes, that is normal.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FOmniSharp%2Fomnisharp-vscode%2Fissues%2F1849%23issuecomment-429163364&data=02%7C01%7C%7C8a8d3f5b4991437cd7ce08d62fd84264%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636749003194840282&sdata=%2B3KbDqnFlF%2F%2FNUDgbLZHlkvvF61nJbQUs1vS3CmV%2BSg%3D&reserved=0, or mute the threadhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAK2FXmqN4-kSjEnvZ0b5xchTd70xqNpnks5uj9_egaJpZM4QX4CK&data=02%7C01%7C%7C8a8d3f5b4991437cd7ce08d62fd84264%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636749003194840282&sdata=F8%2B%2Frvxj1ft2Wt%2BbNPJ5cnS6p%2FqQqh62ENpB633Jm0k%3D&reserved=0.
I meant that it is expected that c:\Program Filesdotnet\ is on the PATH, but c:\Program Filesdotnet\sdk\2.1.302\SDKs is not.
do you know if it Iis expected that I need to _manually add_ the dotnet core’s SDK subdirectory to the path to get this to work for a project that’s built using dotnet core that is in the path
This is not expected.
See also https://github.com/OmniSharp/omnisharp-vscode/issues/2604#issuecomment-430046231
I would like to add my two cents to this:
<TargetFramework>netcoreapp2.1</TargetFramework>.NET Core SDK (reflecting any global.json):
Version: 2.1.302
Commit: 9048955601
Runtime Environment:
OS Name: opensuse-tumbleweed
OS Version: 20181015
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/2.1.302/
Host (useful for support):
Version: 2.1.2
Commit: 811c3ce6c0
.NET Core SDKs installed:
2.1.4 [/usr/share/dotnet/sdk]
2.1.302 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
After picking through the GIT issues related to
'Microsoft.NET.Sdk' specified could not be found
To track down my problem I created a brand new project:
dotnet new console
COREHOST_TRACE=1 code .
This was enough to reproduce the problem and my log showed how Omnisharp resolved its paths.
...
MSBuildToolsDirectory32: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin
MSBuildToolsDirectory64: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin
MSBuildSDKsPath: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin/Sdks
CurrentMSBuildConfigurationFile: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin/MSBuild.dll.config
CurrentMSBuildExePath: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin/MSBuild.dll
CurrentMSBuildToolsDirectory: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin
VisualStudioInstallRootDirectory:
MSBuildExtensionsPath: ~/.vscode/extensions/ms-vscode.csharp-1.16.2/.omnisharp/1.32.7-beta.8/omnisharp/msbuild/15.0/Bin
...
Of course there is no Microsoft.NET.Sdk in the built in $(MSBuildSDKsPath) hence my error.
The SDK 'Microsoft.NET.Sdk' specified could not be found. ~/Work/se.client/se.client.csproj`
Somehow I need to get Omnisharp to resolve to /usr/share/dotnet/sdk instead. My problem was a combination of a dead soft link and my PATH variable.
@host:~/Work/se.client$ echo $PATH
~/bin:/usr/local/bin:/usr/bin:/bin:/~/.dotnet/tools
@host:~/Work/se.client$ which dotnet
/usr/bin/dotnet
@host:~/Work/se.client$ ls
lrwxrwxrwx 1 root root 18 Oct 26 07:56 dotnet -> /opt/dotnet/dotnet
The link /usr/local/bin/dotnet was invalid; it is a remnant of my old manual installation, i.e. /opt/dotnet no longer exists. Deleting the dead link fixed my problem and everything works again.
I surmise the following:
dotnet and falls back to a differentTo recreate my error on a working system:
mkdir -p ~/snf/bin
cd ~/snf/bin
ln -sf `which dotnet`_bad dotnet
mkdir -p ~/snf/test
cd ~/snf/test
dotnet new console
export PATH=~/snf/bin:${PATH}
COREHOST_TRACE=1 code .
@ChickJ Thanks for sharing--you're right that we could improve how we handle unresolvable paths. I've filed https://github.com/OmniSharp/omnisharp-vscode/issues/2629 to track this.
I've got the same issue: 'Microsoft.NET.Sdk' specified could not be found. Macosx, OmniSharp 1.18.0-beta6.
Fixed it by setting up MSBuildSDKsPath=/usr/local/share/dotnet/sdk/3.0.100-preview-010184/Sdks
I assume it is not expected behaviour.
dotnet --info
`.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview-010184
Commit: c57bde4593
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100-preview-010184/
Host (useful for support):
Version: 3.0.0-preview-27324-5
Commit: 63a01b08e5
.NET Core SDKs installed:
2.2.103 [/usr/local/share/dotnet/sdk]
3.0.100-preview-010184 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview-19075-0444 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview-27324-5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
`
This issue doesn't seem specific to VSCode integration and can happen woth OmniSharp roslyn in general.
See https://github.com/OmniSharp/omnisharp-roslyn/issues/1416#issuecomment-477284941
So I ran into this issue today as well. But I fixed it.
I'm running:
I think what caused it was my process:
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. C:\Path\to\your\project\file\here.csprojTo possibly resolve:
Could it really be possible that a simple restart after installing core and before installing the extension to allow environment variables to exist/update is the solution?
Most helpful comment
@anorborg : As a workaround, you should also be able to make it work by setting the
MSBuildSDKsPathenvironment variable to/usr/local/share/dotnet/sdk/2.0.2/Sdks.