Reputation: 83567
A teammate recently updated our code base to use .NET Core 6.0 and I'm trying to build the project in JetBrains Rider.
I went to File > Preferences > Environment and clicked on the Update button for .NET.
I think I have the 6.0 SDK installed:
% dotnet --list-sdks
3.1.411 [/usr/local/share/dotnet/sdk]
3.1.412 [/usr/local/share/dotnet/sdk]
5.0.302 [/usr/local/share/dotnet/sdk]
5.0.400 [/usr/local/share/dotnet/sdk]
6.0.202 [/usr/local/share/dotnet/sdk]
There is a global.json
file in the project root:
% cat global.json
{
"sdk": {
"version": "6.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
}
However, when I do Build > Build Solution, I still get the following error:
Microsoft.NET.TargetFrameworkInference.targets(141, 5): [NETSDK1045] The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0.
What else do I need to do to build the project in Rider?
Upvotes: 12
Views: 22578
Reputation: 33
One thing that I have experienced multiple times now is that if I don't update to the latest version of Rider then Rider cannot find the newer SDKs even when they are installed I've done this about three times now and each time its always the same problem. .NetCore comes out with a new version and Rider has to catch up to it in order for it to get it working. (Hence the update). If you're not the best at keeping your tools up to date like myself, this may be your problem as well. Good luck!
Upvotes: 1
Reputation: 83567
Thanks to LexLi pointing me in the right direction. The solution here is to select the correct version of MS Build. To do this, I went to
File > Preferences > Build, Execution, Deployment > Toolset and Build
Then for MSBuild version, I selected 17.0. Originally version 16.0 had been selected.
Upvotes: 20