这是我在电脑上安装的.NET 的信息。
dotnet --信息
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.6c33ef20
Runtime Environment:
OS Name: linuxmint
OS Version: 21.2
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.100/
.NET workloads installed:
Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71
.NET SDKs installed:
6.0.417 [/usr/share/dotnet/sdk]
7.0.404 [/usr/share/dotnet/sdk]
8.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
安装的dotnet工具是
Package Id Version Commands
----------------------------------------
dotnet-ef 8.0.0 dotnet-ef
volo.abp.cli 8.0.0 abp
运行任何 dotnet 工具时都会收到此错误:
oem@behnam ~/.d/tools> dotnet-ef 您必须安装或更新 .NET 才能运行此应用程序。
应用程序:/home/oem/.dotnet/tools/dotnet-ef 架构:x64 框架:“Microsoft.NETCore.App”,版本“8.0.0”(x64) .NET 位置:/usr/lib/dotnet
发现以下框架: 6.0.25 在 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
了解框架解析: https://aka.ms/dotnet/app-launch-failed
要安装缺少的框架,请下载: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=linuxmint.21.2-x64
或
oem@behnam ~/.d/tools [SIGTTOU]> abp 您必须安装或更新 .NET 才能运行此应用程序。
应用程序:/home/oem/.dotnet/tools/abp 架构:x64 框架:“Microsoft.NETCore.App”,版本“8.0.0”(x64) .NET 位置:/usr/lib/dotnet
发现以下框架: 6.0.25 在 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
了解框架解析: https://aka.ms/dotnet/app-launch-failed
要安装缺少的框架,请下载: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=8.0.0&arch=x64&rid=linuxmint.21.2-x64
问题已解决。
1- 首先,卸载所有已安装的软件包。
sudo apt remove --purge --autoremove *dotnet*
2-创建偏好
sudo nano /etc/apt/preferences
3-添加这些行
Package: *net*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
4-重新安装.net
sudo apt install dotnet-sdk-8.0
5-更新(bashrc)
nano ~/.bashrc
6-添加以下路径
export PATH="$PATH:/usr/share/dotnet"
export PATH="$PATH:~/.dotnet/tools/"
export "DOTNET_ROOT=/usr/share/dotnet"
对于任何 asdf 用户来说,这足以让
dotnet ef
工作:
export DOTNET_ROOT=`asdf where dotnet-core`
目前将其设置为
/home/<user>/.asdf/installs/dotnet-core/8.0.100