I had installed .Net Core 3.1 application on my Ubuntu 18/20 server. As the .Net Core 6 was released recently, I upgraded the source code to .Net Core 6. Instead of “upgrading” or co-hosting multiple .Net Core frameworks, I wanted to clean install .Net Core 6. In order to do that, I wanted to completely remove .Net Core 3.1 from Ubuntu 18/20. Here are the quick commands that I used.
Commands to View Installed Components
Run these commands on Ubuntu Terminal to view installed .Net Core components.
dotnet --list-sdks dotnet --list-runtime
Commands to Remove .Net Core 3.1
Run following commands on Ubuntu Terminal to remove ASP .Net Core 3.1 Runtime and .Net Core 3.1 Runtime. If you have SDK installed on the server, you need to choose appropriate commands to remove those SDKs.
sudo apt-get remove aspnetcore-runtime-3.1 sudo apt-get remove dotnet-runtime-3.1
Above commands still keeps the dotnet host so you are able to use “dotnet” command. If you want to completely remove it, use following commands.
sudo apt-get remove dotnet-hostfxr-3.1 sudo apt-get remove dotnet-runtime-deps-3.1 sudo apt-get remove dotnet-host