2

如何在 Ubuntu Linux 解除安裝 .NET SDK 或 Runtime 任意版本

 2 years ago
source link: https://blog.miniasp.com/post/2021/09/16/How-to-uninstall-NET-SDK-Runtime-in-Ubuntu-Linux
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
如何在 Ubuntu Linux 解除安裝 .NET SDK 或 Runtime 任意版本

雖然 .NET 有個 Uninstall Tool 可以用來解除安裝任何 .NET / .NET Core 版本,但是目前依然不支援 Linux 版本,可能是 Linux 生態實在是太複雜了,所以一直沒有提供好用簡便的反安裝工具。今天這篇文章我將分享幾個好用的命令,幫助你快速解除安裝現有的 .NET SDK 與 Runtime 版本。

  • 檢查目前已安裝 .NET 版本

    dotnet --info
    
  • 查看已安裝的 .NET 相關套件

    apt list --installed  | grep dotnet
    
  • 查詢特定檔案隸屬於哪個套件

    sudo apt install apt-file
    sudo apt-file update
    
    apt-file search $(which dotnet)
    
  • 移除所有版本

    sudo apt-get remove -y dotnet-host
    sudo apt-get autoremove -y
    
  • 移除特定版本 .NET SDK

    sudo apt-get remove -y dotnet-sdk-5.0
    
  • 移除特定版本 .NET Runtime

    sudo apt-get remove -y dotnet-runtime-5.0
    sudo apt-get remove -y aspnetcore-runtime-5.0
    
  • 安裝 .NET 6.0 SDK (v6.0.100-rc.1) - Linux x64 Binaries

    wget https://download.visualstudio.microsoft.com/download/pr/4880c5a4-9c22-47a7-b298-651f1294a385/795f7828d8684059705e625b33027f89/dotnet-sdk-6.0.100-rc.1.21458.32-linux-x64.tar.gz
    
    mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-6.0.100-rc.1.21458.32-linux-x64.tar.gz -C $HOME/dotnet
    export DOTNET_ROOT=$HOME/dotnet
    export PATH=$PATH:$HOME/dotnet
    

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK