Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

.net-core

I've been using Visual Studio Community IDE to develop some apps lately, and I just saw multiple .NET Core SDK with slightly different minor version updates installed on my desktop. (possibly installed along with the VS updates pushed by Microsoft)

Question: can I just keep the latest version? (e.g. 2.1.103 in the case).

or I have to keep all these versions (~460MB each in size) to keep the Visual Studio working, which is insane considering that my SSD is running out of free space (eventually)...

multiple .net core SDKs installed

like image 311
Leemax Avatar asked Apr 17 '18 03:04

Leemax


People also ask

Can I have multiple .NET Core versions installed?

You may have multiple versions of . NET Core installed on same box and some applications may need some specific version of . NET Core. This is why installers doesn't remove previous versions.

Can I remove older versions of .NET Core SDK?

NET Runtime updates are compatible with the latest major version of the . NET SDKs. This means that you can remove safely the older versions.

Is it safe to uninstall .NET Core SDK?

json-based applications. Unless your application has specific reasons for earlier SDKs or runtimes, you may safely remove older versions.

How do I switch between .NET versions?

Open your project's source folder and, in the address bar, type "cmd" and press Enter. It will open the command prompt with the project path. Execute the following command: dotnet --version .


1 Answers

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]
like image 123
Nicholas Avatar answered Oct 11 '22 04:10

Nicholas