Update to .NET Core 6.0 in JetBrains Rider
Asked Answered
T

1

11

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?

Trousers answered 6/5, 2022 at 22:57 Comment(7)
Have you installed the .Net 6 SDK?Sheikdom
I think so? I updated .NET Core through the Preferences UI in Rider.Trousers
@DarrylBraaten Added output from dotnet --list-sdks.Trousers
Running dotnet elsewhere might not help. Can you run it inside the project folder? Besides, check if there is a global.json file that blocks .NET 6 SDK from loading.Laterite
@LexLi Thanks for the suggestions for things to look at. The output I show for dotnet --list-sdks is from the project root. There is a global.json file in the project root. It specifies the version as 6.0.0Trousers
Can you open up your Rider settings and compare to "Using JetBrains Rider" in mfractor.com/blogs/news/…? That might reveal a little bit more around the setup.Laterite
@LexLi Thanks. That seems to point me in the right direction. I'll post an answer below.Trousers
T
18

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.

Trousers answered 6/5, 2022 at 23:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.