I have installed dotnet on my Ubuntu 20.10 but for some reason I want to remove it but I don't know how to do it please help.
Run these commands:
sudo apt remove --purge dotnet-sdk-5.0.101 sudo apt remove --purge dotnet-runtime-5.0.101
2not working for me sudo dotnet --list-sdks 6.0.101 [/snap/dotnet-sdk/152/sdk] sudo apt remove --purge dotnet-sdk-6.0.101 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package dotnet-sdk-6.0.101 E: Couldn't find any package by glob 'dotnet-sdk-6.0.101'– madanJan 7, 2022 at 10:37
@madan Try with "major.minor", like
sudo apt purge dotnet-sdk-6.0– kolFeb 23, 2022 at 14:13
thanks kol, i am afraid i do not currently have this issue so can't try the solution– madanFeb 24, 2022 at 11:33
Try with major and minor version only:
sudo apt remove --purge dotnet-sdk-6.0 sudo apt remove --purge dotnet-runtime-6.0
For the situation where
dotnet has been installed using
snap, you can do the following:
You need to list the names of the snap packages by going to the
/snapdirectory. For example, on Ubuntu 21, my
dotnetinstallations are shown in the following script.
$ cd /snap $ ls ... dotnet-sdk dotnet-runtime-60 ...
Then you can use the following commands to remove the snaps.
sudo snap remove dotnet-sdk sudo snap remove dotnet-runtime-60
This was based on the answer for snap packages here: How to list files installed by a snap package?
All you have to do is just put the major version number, for example 3.1 or 5.0. You don't have to put any other minor version number/reference number just major version number will do.
For example for lets say your donet-sdk version is 3.1.416 then just right
sudo apt remove --purge dotnet-sdk-3.1 sudo apt remove --purge dotnet-runtime-3.1
FYI askubuntu.com/a/1388621/1210606 is the correct answer because this comment from am year ago askubuntu.com/questions/1305271/… showed it was a snap. Jan 28, 2022 at 21:19
1What a mess this is - been stuck for hours trying to install .net 6 & 7 - On my 5th full uninstall and reinstall - The FULL uninstall does not get rid of .NET so attempting a clean install not possible. The microsoft instructions dont work - no surprise there, and I cant find any reliable instructions anywhere. None of the above commands remove everything. After using remove or purge, dotnet cmd is still showing. The latest error is Segmentation Fault - corrupted memory.– GregFeb 21 at 19:25