-
Notifications
You must be signed in to change notification settings - Fork 676
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
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. #1849
Comments
Sorry I need to update my issue report.
it is working. BUT with out any MSBuildSDKsPath being set it defaults to the non existing path
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 |
Yes, I can confirm that there is a SdkResolvers folder (containing a Microsoft.DotNet.MSBuildSdkResolver...). |
Thanks! Without |
Okay, I added
|
I am also seeing this with the latest vs-code on macOS, omnishap, and dotnet on a fresh classlib project Environmentms-vscode.csharp 1.13.0
Error
|
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 |
@anorborg : As a workaround, you should also be able to make it work by setting the |
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: dotnet/msbuild#2532. |
This is also happening here: #1846 |
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 |
@omartin2010 Is |
dotnet is on my path (specifically, |
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 <[email protected]>
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 GitHub<https://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 thread<https://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 Files\dotnet\ is on the PATH, but c:\Program Files\dotnet\sdk\2.1.302\SDKs is not.
This is not expected. |
See also #2604 (comment) |
I would like to add my two cents to this:
After picking through the GIT issues related to
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.
Of course there is no
Somehow I need to get Omnisharp to resolve to
The link I surmise the following:
To 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 . |
I've got the same issue: 'Microsoft.NET.Sdk' specified could not be found. Macosx, OmniSharp 1.18.0-beta6. dotnet --info Runtime Environment: Host (useful for support): .NET Core SDKs installed: .NET Core runtimes installed: |
This issue doesn't seem specific to VSCode integration and can happen woth OmniSharp roslyn in general. |
So I ran into this issue today as well. But I fixed it. I'm running:
I think what caused it was my process:
To 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? |
Environment data
(No Visual Studio)
VS Code version:
1.18.0
C# Extension version:
ms-vscode.csharp-1.13.0
Steps to reproduce
Start OmniSharp server
(On VS Code startup or Restart OmniSharp)
Expected behavior
OmniSharp server starts and loads all project files.
Actual behavior
See OmniSharp log:
The text was updated successfully, but these errors were encountered: