multiple .net core SDK (of different versions) installed, can I just keep the latest?

Solution 1:

The answer is yes you can. If you'd like to try it out, simply uninstall everything and reinstall the latest SDK from https://dot.net. It'll work. Make sure you keep the one you need though, because if your own project's declaration is specifying the SDK, you NEED that specific SDK. But there's a catch, scroll down.

https://github.com/dotnet/docs/issues/4241

Quoted from Bill Wagner,

In summary, the .NET Core SDK is backwards compatible and the newest one on the box is used unless there is a global.json file that indicates another version of the SDK.

So, the short answer is:

  • You need the one you want to run (latest suggested and previews should be fine) * And, any that are specified in global.json

If a SDK version is in a global.json on your machine, and you do not have that version, you will roll forward across patch, but not feature versions of the SDK. Except that the roll forward behavior is overly aggressive in the the 2.1.x -> 2.1.300 range. For that range, we recommend you not do roll forward but have the specified version available.

The catch is here.

One correction.

By the time 2.1.300 ships, we will not rollforward from 2.1.x to 2.1.300. We will keep within the boundaries of the release.

So:

2.1.x => 2.1.1, 2.1.9, 2.1.10… 2.1.100 => 2.1.100, 2.1.101, 2.110… 2.2.200 > 2.1.200, 2.1.201,…

As quoted by Kathleen Dollard, you need to follow this guideline to develop on specific versions of the SDK according to your project/s.

To check your current machine's SDKs installed on macOS:

 ✘ nixholas@Nicholass-MacBook-Pro  ~/Projects/nozomi   staging  dotnet --list-sdks
1.0.3 [/usr/local/share/dotnet/sdk]
1.0.4 [/usr/local/share/dotnet/sdk]
2.0.0-preview2-006497 [/usr/local/share/dotnet/sdk]
2.0.0 [/usr/local/share/dotnet/sdk]
2.1.4 [/usr/local/share/dotnet/sdk]
2.1.101 [/usr/local/share/dotnet/sdk]
2.1.104 [/usr/local/share/dotnet/sdk]
2.1.300-rc1-008673 [/usr/local/share/dotnet/sdk]
2.1.300 [/usr/local/share/dotnet/sdk]
2.1.301 [/usr/local/share/dotnet/sdk]
2.1.400 [/usr/local/share/dotnet/sdk]
2.1.402 [/usr/local/share/dotnet/sdk]
2.1.500 [/usr/local/share/dotnet/sdk]
2.2.101 [/usr/local/share/dotnet/sdk]
2.2.103 [/usr/local/share/dotnet/sdk]
2.2.104 [/usr/local/share/dotnet/sdk]
2.2.105 [/usr/local/share/dotnet/sdk]
2.2.300 [/usr/local/share/dotnet/sdk]
2.2.301 [/usr/local/share/dotnet/sdk]