How to remove previous versions of .NET Core from Linux (CentOS 7.1)
Asked Answered
P

8

26

I would like to install the current version Core 1.0. Currently the RC2 version is installed. The instruction on the official website are:

Before you start, please remove any previous versions of .NET Core from your system.

But I don't know how and I can't find nothing from Microsoft like for example here.

I found this script... but my Linux skills are not great and I won't make it worst.

Patronymic answered 24/8, 2016 at 9:37 Comment(0)
P
5

Sometimes it can be so simple! In order to remove the previous installation, simply remove the dotnet folder from where you installed it on disk.

Big Thanks to Zlatko Knezevic

Patronymic answered 25/8, 2016 at 21:40 Comment(1)
facing permission issue in this wayUnderlaid
D
50

You need to do this over the package manager, otherwise, you end up with a broken system.

This is for Ubuntu/Debian/Mint:

To list all installed packages

sudo apt --installed list

To list all the packages you installed

sudo apt --installed list | grep "dotnet-dev"

to remove a specific package

sudo apt-get remove --purge PACKAGE_NAME 

e.g.

sudo apt-get remove --purge dotnet-dev-1.0.1

For other distros, consult the Packman-Rosetta-Stone

Disassociate answered 5/4, 2017 at 13:4 Comment(2)
Ok, this make sense, but what if i install it via dotnet-install.sh ? how i can uninstall it or update?Veratrine
Command does not run on 22.04Troutman
D
8

In CentOS you would do the following:

1 - Find the package installed

yum list installed | grep "aspnet"

2 - Remove the package

yum remove aspnetcore-store-2.0.0.x86_64
Desimone answered 20/6, 2018 at 8:45 Comment(0)
M
7

On Ubuntu:

First list the dotnet packages installed:

$ sudo apt --installed list | grep "dotnet"

You'll have a result like this:

dotnet-apphost-pack-3.0    dotnet-hostfxr-3.1         dotnet-runtime-deps-5.0
dotnet-apphost-pack-3.1    dotnet-hostfxr-5.0         dotnet-sdk-5.0
dotnet-apphost-pack-5.0    dotnet-runtime-5.0         dotnet-targeting-pack-3.0
dotnet-host                dotnet-runtime-deps-2.2    dotnet-targeting-pack-3.1
dotnet-hostfxr-2.2         dotnet-runtime-deps-3.0    dotnet-targeting-pack-5.0
dotnet-hostfxr-3.0         dotnet-runtime-deps-3.1 

To uninstall the packages of linked to version 3 for example just type:

$ sudo apt-get remove --purge dotnet-*3*
Maker answered 21/2, 2021 at 17:29 Comment(4)
That commmand does not run on 22.04Troutman
@Troutman apt command on Ubuntu? Are you sure? That's a firstMaker
sudo apt --installed list | grep "dotnet" Does Not Run on Ubuntu 22.04 for me.Troutman
Whats the error?Maker
P
5

Sometimes it can be so simple! In order to remove the previous installation, simply remove the dotnet folder from where you installed it on disk.

Big Thanks to Zlatko Knezevic

Patronymic answered 25/8, 2016 at 21:40 Comment(1)
facing permission issue in this wayUnderlaid
L
3

For any CentOS users, the yum command is used to install/uninstall packages, here is how you do it in CentOS:

yum remove dotnet-sdk-2.0.0
Leff answered 1/1, 2018 at 4:11 Comment(1)
I came to the same conclusion from learn.microsoft.com/en-us/dotnet/core/versions/… for ThanksLykins
C
3

Here is what I found on MSDN and It worked for me as charm. First list the install SDKs using below command

dotnet --list-sdks

Then run below set of commands after updating version as found in above command.

version="1.0.1"
sudo rm -rf /usr/share/dotnet/sdk/$version
sudo rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/$version
sudo rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.All/$version
sudo rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$version
sudo rm -rf /usr/share/dotnet/host/fxr/$version
Cletacleti answered 23/2, 2022 at 11:9 Comment(0)
K
1

Today I was uninstalling old version of dotnet on my Linux Mint. First I typed:

$ sudo apt remove dotnet

Then I pressed tab. It showed all related packages. I simply copied them and pasted:

$ sudo apt remove dotnet-host dotnet-runtime-2.2 dotnet-sdk-2.2 dotnet-hostfxr-2.2 dotnet-runtime-deps-2.2 

I guess in Fedora/CentOS, the procedure is same. Just use yum instead of apt. I hope this helps. :)

Krystlekrystyna answered 4/10, 2019 at 8:3 Comment(0)
B
0

Here's what I did to remove all dotnet versions:

1- List all dotnet packages

sudo apt — installed list | grep "dotnet"

2- Remove them one by one. Change this list according to the output command of step 1:

Change this list according to the output command of step 1.

sudo apt-get remove - purge -y dotnet-host 
sudo apt-get remove - purge -y dotnet-hostfxr-5.0 
sudo apt-get remove - purge -y dotnet-runtime-5.0 
sudo apt-get remove - purge -y dotnet-runtime-deps-5.0 
sudo apt-get remove - purge -y dotnet-sdk-5.0
sudo apt-get remove - purge -y dotnet-targeting-pack-5.0 
sudo apt-get remove - purge -y dotnet-apphost-pack-5.0 
sudo apt-get remove - purge -y dotnet-runtime-6.0 
sudo apt-get remove - purge -y dotnet-hostfxr-6.0
sudo apt-get remove - purge -y dotnet-runtime-deps-6.0 
sudo apt-get remove - purge -y dotnet-targeting-pack-6.0
sudo apt-get remove --purge -y dotnet-apphost-pack-6.0
sudo apt-get remove --purge -y dotnet-host/now 6.0.0
sudo apt-get remove - purge -y dotnet-apphost-pack-6.0

My article link about this: https://medium.com/@alperonline/how-to-uninstall-dotnet-from-ubuntu-c42b9c016ec9

Bigeye answered 21/11, 2021 at 13:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.