原环境:
.NET Core SDK(反映任何 global.json):
Version: 2.2.110
Commit: 4797dabd3c
运行时环境:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:Program Filesdotnetsdk2.2.110
Host (useful for support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
2.1.522 [C:Program Filesdotnetsdk]
2.2.110 [C:Program Filesdotnetsdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.26 [C:Program FilesdotnetsharedMicrosoft.AspN
etCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:Program FilesdotnetsharedMicrosoft.AspNe
tCore.All]
Microsoft.AspNetCore.App 2.1.26 [C:Program FilesdotnetsharedMicrosoft.AspN
etCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:Program FilesdotnetsharedMicrosoft.AspNe
tCore.App]
Microsoft.NETCore.App 2.1.26 [C:Program FilesdotnetsharedMicrosoft.NETCore
.App]
Microsoft.NETCore.App 2.2.8 [C:Program FilesdotnetsharedMicrosoft.NETCore.
App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
现环境:
root@servercore:~# dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.402
Commit: c7f2f96116
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.2.402/
Host (useful for support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
2.2.402 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
当然sdk使用2.2.108比2.2.110可能要稳一点,微软官方开发环境的最佳sdk版本图:
OS | Development Environment | .NET Core SDK |
---|---|---|
Any supported | Command line and/or Visual Studio Code | 2.2.401 |
Windows | Visual Studio 2019 version 16.2 | 2.2.401 |
Windows | Visual Studio 2019 version 16.1 | 2.2.301 |
Windows | Visual Studio 2019 version 16.0 | 2.2.205 |
Windows | Visual Studio 2017 | 2.2.108 |
二,验证过程
1.卸载(参照:微软文档):
dpkg --list #查看安装的包
#apt-get remove 要删除的包
apt-get remove dotnet-host
apt-get remove dotnet-hostfxr
apt-get remove dotnet-runtime
apt-get remove dotnet-sdk-2.2
2.安装:
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2=2.2.110-1
#sudo apt-get install dotnet-sdk-2.2=2.2.108-1
3.查看修改完的环境:
.NET Core SDK (reflecting any global.json):
Version: 2.2.110
Commit: 4797dabd3c
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.2.110/
Host (useful for support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
2.2.110 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
OK,修改完毕。