.NET - Uninstall old SDK and Runtimes
Hello koalas
After some months or years, you realize that your computer is cluttered with old .NET SDK and Runtimes from your multiple upgrades.
.NET Framework -> .NET Core -> .NET 5.0 -> .NET ???
You've decided to clean up your computer but how to do it?
It has many ways to do it, but I will let you know 2 of them that Microsoft advice:
- Uninstall manually the SDKs and Runtimes
- Use the tool dotnet-core-uninstall
Uninstall manually
Go to "Apps & Features" and search for the terms "sdk" and "runtime".
You can see below that it has only a SDK installed. Version 5.0.201. So, it's fine!
This time you can see I have 3 runtimes, 3.1.10 / 3.1.13 / 5.0.4. So, I can uninstall the runtimes for .NET Core 3.x because I don't need them anymore.
Source: https://docs.microsoft.com/en-us/dotnet/core/install/remove-runtime-sdk-versions?pivots=os-windows
Uninstall with the tool dotnet-core-uninstall
This official tool from Microsoft allows you to uninstall the old sdks and runtimes on your computer.
You can find out the documentation at this address: https://docs.microsoft.com/en-us/dotnet/core/additional-tools/uninstall-tool?tabs=windows
And the github repo at this one: https://github.com/dotnet/cli-lab/releases
Just start with the following commands:
dotnet-core-uninstall list
and then see what is installed on your computer.
You can then remove a sdk with the command:
dotnet-core-uninstall remove --sdk x.y.z
You can remove a runtime with the command:
dotnet-core-uninstall remove --runtime x.y.z
Important:
The dotnet-core-uninstall has some limitations and cannot uninstall all sdks or runtimes, very often the last ones because the tool must be updated before to be able to do it.
Here is an example:
When I search for my runtimes via the GUI I can see that I have the runtimes 3.1.10 and 3.1.13.
But when I use the tool dotnet-core-uninstall I have no results as you can see.
Finally, I've just uninstalled the runtimes manually to make my computer a bit cleaner!
Hope you enjoy this article!
Didier
Sources used
Name | Link |
How to remove the .NET Runtime and SDK | Link |
Uninstall Tool: dotnet-core-uninstall | Link |