.NET 6 安装说明
1. 安装方法
当前支持 dotnet-sdk 各子模块单独分包安装,各子模块如下:
- aspnetcore-runtime-6.0
- aspnetcore-targeting-pack-6.0
- dotnet-apphost-pack-6.0
- dotnet-host-6.0
- dotnet-hostfxr-6.0
- dotnet-runtime-6.0
- dotnet-runtime-deps-6.0
- dotnet-sdk-6.0
- dotnet-targeting-pack-6.0
- netstandard-targeting-pack-2.1
1.1. 使用包管理器离线安装/卸载
- 从 下载页面 下载安装包,请确认所使用的版本。
- 安装/卸载:(以 dotnet-sdk-6.0.126-1 loongarch64 示例)
deb
# 批量下载离线安装包
$ mkdir dotnet-sdk-6.0.126-packages && cd dotnet-sdk-6.0.126-packages
$ wget http://ftp.loongnix.cn/dotnet/6.0.26/6.0.26-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_6.0.26-1_loongarch64.deb \
./dotnet-hostfxr-6.0_6.0.26-1_loongarch64.deb \
./dotnet-runtime-deps-6.0_6.0.26-1_loongarch64.deb \
./dotnet-runtime-6.0_6.0.26-1_loongarch64.deb \
./dotnet-targeting-pack-6.0_6.0.26-1_loongarch64.deb \
./aspnetcore-targeting-pack-6.0_6.0.26-1_loongarch64.deb \
./dotnet-apphost-pack-6.0_6.0.26-1_loongarch64.deb \
./aspnetcore-runtime-6.0_6.0.26-1_loongarch64.deb \
./netstandard-targeting-pack-2.1_2.1.0-1_loongarch64.deb \
./dotnet-sdk-6.0_6.0.126-1_loongarch64.deb
# 卸载:
$ sudo apt remove dotnet-runtime-deps-6.0 \
dotnet-apphost-pack-6.0 \
dotnet-host \
dotnet-hostfxr-6.0 \
dotnet-runtime-6.0 \
dotnet-sdk-6.0 \
dotnet-targeting-pack-6.0 \
aspnetcore-runtime-6.0 \
aspnetcore-targeting-pack-6.0 \
netstandard-targeting-pack-2.1
rpm
# 批量下载离线安装包
$ mkdir dotnet-sdk-6.0.126-packages && cd dotnet-sdk-6.0.126-packages
$ wget http://ftp.loongnix.cn/dotnet/6.0.26/6.0.26-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-6.0.26-1.loongarch64.rpm \
dotnet-hostfxr-6.0.26-1.loongarch64.rpm \
dotnet-runtime-deps-6.0.26-1.loongarch64.rpm \
dotnet-runtime-6.0.26-1.loongarch64.rpm \
dotnet-targeting-pack-6.0.26-1.loongarch64.rpm \
aspnetcore-targeting-pack-6.0.26-1.loongarch64.rpm \
dotnet-apphost-pack-6.0.26-1.loongarch64.rpm \
aspnetcore-runtime-6.0.26-1.loongarch64.rpm \
netstandard-targeting-pack-2.1.0-1.loongarch64.rpm \
dotnet-sdk-6.0.126-1.loongarch64.rpm
# 卸载:
$ sudo yum remove dotnet-runtime-deps-6.0 \
dotnet-apphost-pack-6.0 \
dotnet-host \
dotnet-hostfxr-6.0 \
dotnet-runtime-6.0 \
dotnet-sdk-6.0 \
dotnet-targeting-pack-6.0 \
aspnetcore-runtime-6.0 \
aspnetcore-targeting-pack-6.0 \
netstandard-targeting-pack-2.1
1.2. 使用包管理器在线安装/卸载
deb
# 在线安装
$ sudo apt install dotnet-sdk-6.0
# 卸载:
$ sudo apt remove dotnet-runtime-deps-6.0 \
dotnet-apphost-pack-6.0 \
dotnet-host \
dotnet-hostfxr-6.0 \
dotnet-runtime-6.0 \
dotnet-sdk-6.0 \
dotnet-targeting-pack-6.0 \
aspnetcore-runtime-6.0 \
aspnetcore-targeting-pack-6.0 \
netstandard-targeting-pack-2.1
rpm
# 在线安装
$ sudo yum install dotnet-sdk-6.0
# 卸载:
$ sudo yum remove dotnet-runtime-deps-6.0 \
dotnet-apphost-pack-6.0 \
dotnet-host \
dotnet-hostfxr-6.0 \
dotnet-runtime-6.0 \
dotnet-sdk-6.0 \
dotnet-targeting-pack-6.0 \
aspnetcore-runtime-6.0 \
aspnetcore-targeting-pack-6.0 \
netstandard-targeting-pack-2.1
1.3. 查看安装结果
$ whereis dotnet
dotnet: /usr/bin/dotnet /usr/share/dotnet /usr/share/man/man1/dotnet.1.gz
1.4. 查看 .NET 版本
更多关于 .NET 的使用方法及示例,请参考 .NET在线文档
### 查看SDK版本:
可使用终端查看当前安装的 .NET Core SDK 版本。 打开终端并运行以下命令。
dotnet --list-sdks
查看运行时版本:
可使用以下命令查看当前安装的 .NET Core 运行时版本。
dotnet --list-runtimes
详细信息:
可通过以下命令查看 SDK 版本和运行时版本。 你还将获得其他环境相关信息,如操作系统版本和运行时标识符 (RID)。
dotnet --info