卸载、指定卸载 .NET Core Runtime and SDK

项目使用的 Nuget 包,比如 Microsoft.AspNetCore.App等的版本号要与 .NET Core 版本号(不是SDK版本号,后续说明)保持一致,否则编译或者运行的时候可能会出现一些稀奇古怪的错误。

二. 版本对照

https://www.microsoft.com/net/download/dotnet-core/2.1

二. 版本对照

1.查看所有安装的SDK

$ dotnet --list-sdks
1.0.0-preview2-003121 [/usr/local/share/dotnet/sdk]
1.0.1 [/usr/local/share/dotnet/sdk]
2.0.3 [/usr/local/share/dotnet/sdk]
2.1.300 [/usr/local/share/dotnet/sdk]
2.1.403 [/usr/local/share/dotnet/sdk]

2.查看运行时

$ dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

卸载 .NET Core Runtime and SDK

链接:

MAC上面,通过删除包含版本的目录,分开卸载SDKs 和 runtimes(SDK 和 runtime的目录,通过 dotnet --list-sdks 和 dotnet --list-runtimes 命令显示),例如删除 1.0.1 SDK 和 runtime,命令如下:

sudo rm -rf /usr/local/share/dotnet/sdk/1.0.1
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.1
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/1.0.1
sudo rm -rf /usr/local/share/dotnet/host/fxr/1.0.1

从 .NET Core 2.1 开始, 使用package manager升级时,不再需要卸载 .NET Core SDK ,新版本安装成功会自动删除旧版本。

指定SDK版本

.NET Core 版本:  .NET Core 项目默认使用最新版本的 .NET Core

SDK版本: 指定项目SDK版本,dotnet new global.json --sdk-version

卸载、指定卸载 .NET Core Runtime and SDK_第1张图片

 

转载于:https://www.cnblogs.com/mspeer/p/9914011.html

你可能感兴趣的:(卸载、指定卸载 .NET Core Runtime and SDK)