'Update to .NET Core 6.0 in JetBrains Rider

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Code-Apprentice