问题
So I'm using Rider without Visual Studio installed and its working fine for .NET but for .NET Core I'm getting the error:
Project 'Test2' load failed: Das angegebene SDK "Microsoft.NET.Sdk" wurde nicht gefunden. -> (the specified SDK "Microsoft.NET.Sdk" was not found) C:\Users****\RiderProjects\Test2\Test2\Test2.csproj at (0:0)
Project Creating Settings:
The Error when the project is being loaded which fails:
(the blue underline means "the specified SDK "Microsoft.NET.Sdk" was not found")
Rider Toolset and Build Settings:
Installed .Net Core Version:
Rider Version: JetBrains Rider 2018.1.4 Build #RD-181.5550.7
Hope it was detailed enough and you guys can help me to fix this error :)
回答1:
@alphaaxmet
You're using a custom MSBuild version
Check your MSBuildSDKsPath
env. variable, it should be equal to the path with your latest .net core sdk , e.g.: C:\Program Files\dotnet\sdk\2.1.302
回答2:
Thanks to @Damir Beylkhanov 's and @Jura Gorohovsky 's answer, If you are experiencing The Specified SDK “Microsoft.NET.Sdk” was not Found error and you have installed JetBrains Rider 2019 or JetBrains Rider 2020 and Dot NET Core 3.1 on Windows 10 64 bit, see below instructions on How to Fix that;
You will need to use the MSBuild that comes with Dot NET Core 3.1 instead of the one that is provided by your installed Dot NET Runtime 3.x or 4.x
So here is how to locate and add the MSBuild that is needed for your Rider Jetbreains IDE if you are using Dot NET Core 3.1.
I was working with a Windows 10 64 bit OS and JetBrains Rider 2019.2.3 I do not know if this is How it works for other Windows platforms or previous versions of JetBrains Rider.
For 64 bit based Windows 10, after you install Dot NET Core 3.1 , your MSBuild.dll will be in this path C:\Program Files\dotnet\sdk\3.1.100
You may also consider adding the path C:\Program Files\dotnet\sdk\3.1.100 to your environment variables.
So here is How to do it.
Click Tools -> Settings in JetBrains Rider 2019.2.3
Scroll down and locate Build, Execution, Deployment click on it to expand it.
Scroll down and locate Toolset and Build then click on it to open it.
Once you have opened Toolset and Build, find below the option for editing Use MSBuild version and click the Custom button to the right to browse for the MS Build you want to use.
Browse to the path where your Dot NET Core 3.1 is installed and select the MSBuild dll file there. In my case it was this path C:\Program Files\dotnet\sdk\3.1.100.
Once you have selected the MSBuild.dll that installed with your Dot NET Core 3.1, click OK and OK any other open windows then run your Project again. It should work fine now.
See below screenshot for where circled in red to follow through the same process as I did it on my JetBrains Rider IDE. The same screenshot herein also shows the path for MSBuild.dll in my Windows Desktop Computer.
回答3:
I was getting this error when trying to load projects targetting .NET core (Project Sdk property Microsoft.NET.Sdk). My environment at the time of this issue was as follows:
- .NET Core SDK 2.1.103 through 3.1.102 installed
- JetBrains Rider 2019.3.4 installed
- Visual Studio 2019 Professional 16.4.5 installed
Rider was able to open the project and solution absolutely fine, although VS 2019 kept complaining about missing SDK. This was a solution with 2 projects both with SDK as Microsoft.NET.Sdk. I then opened a solution that had a web project in it in VS 2019 i.e. Microsoft.NET.Sdk.Web. VS 2019 showed a prompt that said that I needed additional workloads to be installed. When I clicked ok, VS Installer launched and automatically selected "ASP.NET and web development" under workloads. After the installation finished, the web project opened fine but the project with Microsoft.NET.Sdk as the SDK continued to complain about missing SDK.
On further research, I came across this github issue where @akshita31 recommended installing .NET core build tools. Following this:
- I relaunched VS 2019 installer
- Looked under "Other Toolsets" (scroll at the bottom of the installer Workloads tab) and checked ".NET Core cross-platform development" and followed through.
- After the installer finished, VS 2019 could open all projects without issues
来源:https://stackoverflow.com/questions/51778267/the-specified-sdk-microsoft-net-sdk-was-not-found