Uninstall .Net Core 3.1 From Ubuntu 18/20

Uninstall .Net Core 3

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-runtimes

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



2 responses to “Uninstall .Net Core 3.1 From Ubuntu 18/20”

  1. Stephen Sepan Avatar
    Stephen Sepan

    Thank You for the helpful article. One typo to note…

    dotnet –list-runtime

    …did not work for me, but the following did…

    dotnet –list-runtimes

    1. Vishal Monpara Avatar
      Vishal Monpara

      Thanks Stephen,

      I fixed typo.

      Vishal Monpara

Leave a Reply

Your email address will not be published. Required fields are marked *