.NET 8 安装说明


1. 安装方法

当前支持 dotnet-sdk 各子模块单独分包安装,各子模块如下:

  • aspnetcore-runtime-8.0
  • aspnetcore-targeting-pack-8.0
  • dotnet-apphost-pack-8.0
  • dotnet-host-8.0
  • dotnet-hostfxr-8.0
  • dotnet-runtime-8.0
  • dotnet-runtime-deps-8.0
  • dotnet-sdk-8.0
  • dotnet-targeting-pack-8.0
  • netstandard-targeting-pack-2.1

1.1. 手动安装压缩包

如果运行这些命令,请记住将 DOTNET_FILE 值更改为下载的 .NET 二进制文件的名称。

DOTNET_FILE=dotnet-sdk-8.0.107-linux-loongarch64.tar.xz
export DOTNET_ROOT=$(pwd)/.dotnet

mkdir -p "$DOTNET_ROOT" && tar Jxf "$DOTNET_FILE" -C "$DOTNET_ROOT"

export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

还可以将 .NET 安装到由 HOME 变量或 ~ 路径标识的主目录:

export DOTNET_ROOT=$HOME/.dotnet

1.2. 使用包管理器离线安装/卸载

  • 下载页面 下载安装包,请确认所使用的版本。
  • 安装/卸载:(以 dotnet-sdk-8.0.107-1 loongarch64 示例)

deb

# 批量下载离线安装包
mkdir dotnet-sdk-8.0.107-packages && cd dotnet-sdk-8.0.107-packages
wget http://ftp.loongnix.cn/dotnet/8.0.7/8.0.7-1/deb/ -c -r -np -nd -k -L -p -A deb -A md5 \
                -U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"

# 检查下载的安装包
md5sum -c *.md5

# 离线安装方法:
sudo dpkg -i *.deb

# 或者使用如下命令离线安装,需要注意安装包顺序
sudo apt install ./dotnet-host_8.0.7-1_loongarch64.deb \
                ./dotnet-hostfxr-8.0_8.0.7-1_loongarch64.deb \
                ./dotnet-runtime-deps-8.0_8.0.7-1_loongarch64.deb \
                ./dotnet-runtime-8.0_8.0.7-1_loongarch64.deb \
                ./dotnet-targeting-pack-8.0_8.0.7-1_loongarch64.deb \
                ./aspnetcore-targeting-pack-8.0_8.0.7-1_loongarch64.deb \
                ./dotnet-apphost-pack-8.0_8.0.7-1_loongarch64.deb \
                ./aspnetcore-runtime-8.0_8.0.7-1_loongarch64.deb \
                ./netstandard-targeting-pack-2.1_2.1.0-1_loongarch64.deb \
                ./dotnet-sdk-8.0_8.0.107-1_loongarch64.deb

# 卸载:
sudo apt remove dotnet-runtime-deps-8.0 \
                dotnet-apphost-pack-8.0 \
                dotnet-host \
                dotnet-hostfxr-8.0 \
                dotnet-runtime-8.0 \
                dotnet-sdk-8.0 \
                dotnet-targeting-pack-8.0 \
                aspnetcore-runtime-8.0 \
                aspnetcore-targeting-pack-8.0 \
                netstandard-targeting-pack-2.1

rpm

# 批量下载离线安装包
mkdir dotnet-sdk-8.0.107-packages && cd dotnet-sdk-8.0.107-packages
wget http://ftp.loongnix.cn/dotnet/8.0.7/8.0.7-1/rpm_lns/ -c -r -np -nd -k -L -p -A rpm -A md5 \
                -U "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"

# 检查下载的安装包
md5sum -c *.md5

# 离线安装命令,需要注意安装包顺序 - Loongnix Server RPM
sudo yum install dotnet-host-8.0.7-1.loongarch64.rpm \
                dotnet-hostfxr-8.0.7-1.loongarch64.rpm \
                dotnet-runtime-deps-8.0.7-1.loongarch64.rpm \
                dotnet-runtime-8.0.7-1.loongarch64.rpm \
                dotnet-targeting-pack-8.0.7-1.loongarch64.rpm \
                aspnetcore-targeting-pack-8.0.7-1.loongarch64.rpm \
                dotnet-apphost-pack-8.0.7-1.loongarch64.rpm \
                aspnetcore-runtime-8.0.7-1.loongarch64.rpm \
                netstandard-targeting-pack-2.1.0-1.loongarch64.rpm \
                dotnet-sdk-8.0.107-1.loongarch64.rpm

# 卸载:
sudo yum remove dotnet-runtime-deps-8.0 \
                dotnet-apphost-pack-8.0 \
                dotnet-host \
                dotnet-hostfxr-8.0 \
                dotnet-runtime-8.0 \
                dotnet-sdk-8.0 \
                dotnet-targeting-pack-8.0 \
                aspnetcore-runtime-8.0 \
                aspnetcore-targeting-pack-8.0 \
                netstandard-targeting-pack-2.1

1.3. 使用包管理器在线安装/卸载

deb

# 在线安装
sudo apt install dotnet-sdk-8.0

# 卸载:
sudo apt remove dotnet-runtime-deps-8.0 \
                dotnet-apphost-pack-8.0 \
                dotnet-host \
                dotnet-hostfxr-8.0 \
                dotnet-runtime-8.0 \
                dotnet-sdk-8.0 \
                dotnet-targeting-pack-8.0 \
                aspnetcore-runtime-8.0 \
                aspnetcore-targeting-pack-8.0 \
                netstandard-targeting-pack-2.1

rpm

# 在线安装
sudo yum install dotnet-sdk-8.0

# 卸载:
sudo yum remove dotnet-runtime-deps-8.0 \
                dotnet-apphost-pack-8.0 \
                dotnet-host \
                dotnet-hostfxr-8.0 \
                dotnet-runtime-8.0 \
                dotnet-sdk-8.0 \
                dotnet-targeting-pack-8.0 \
                aspnetcore-runtime-8.0 \
                aspnetcore-targeting-pack-8.0 \
                netstandard-targeting-pack-2.1

1.4. 查看安装结果

whereis dotnet
dotnet: /usr/bin/dotnet /usr/share/dotnet /usr/share/man/man1/dotnet.1.gz

1.5. 查看 .NET 版本

更多关于 .NET 的使用方法及示例,请参考 .NET在线文档

### 查看SDK版本:

可使用终端查看当前安装的 .NET Core SDK 版本。 打开终端并运行以下命令。

dotnet --list-sdks

查看运行时版本:

可使用以下命令查看当前安装的 .NET Core 运行时版本。

dotnet --list-runtimes

详细信息:

可通过以下命令查看 SDK 版本和运行时版本。 你还将获得其他环境相关信息,如操作系统版本和运行时标识符 (RID)。

dotnet --info

©龙芯开源社区 all right reserved,powered by Gitbook文档更新时间: 2024-07-31 11:33:12

results matching ""

    No results matching ""

    results matching ""

      No results matching ""