• ubuntu下.NET Core手动更换版本(卸载再安装)


    原环境

    .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版本图:

    OSDevelopment 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,修改完毕。

    365个夜晚,我希望做到两天更一篇博客。加油,小白!
  • 相关阅读:
    启动程序相关的命令
    分享的几行代码
    各种大数据软件安装
    tomcat报没法分配内存大小解决方案
    数据库事务
    pytorch之CNN实现
    搜索与匹配
    调试 pytorch 及 python 的 特殊语法
    图神经网络 GCN 等综述(转载)
    关于【finder不能完成该操作 因为未能读取或写入"文件名"中的某些数据(错误代码-36)】(实测,好用)
  • 原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/14661936.html
Copyright © 2020-2023  润新知