如何修复损坏的 .NET 6 安装?

如何修复损坏的 .NET 6 安装?

我的 Ubuntu 系统上有 .NET 6 和 .NET 7。当我尝试在 Rider 中执行测试时,它显示未安装 dotnet 6。但实际上已经安装了。如果我运行dotnet --list-runtimes它,它只会显示 .NET 7。

控制台输出:

Reading state information... Done
aspnetcore-runtime-6.0 is already the newest version (6.0.110-0ubuntu1~22.04.1).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
aaronlord@system76-pc:~/Downloads$ dotnet --list-runtimes
Microsoft.AspNetCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
aaronlord@system76-pc:~/Downloads$ dotnet --list-sdks
6.0.403 [/usr/share/dotnet/sdk]
7.0.100 [/usr/share/dotnet/sdk]

答案1

步骤 1:卸载https://askubuntu.com/a/1386715/231561

第 2 步:在 preference.d 中设置 propshttps://stackoverflow.com/a/73899341/16454

步骤 3:使用一些明确的值进行安装https://github.com/dotnet/sdk/issues/27082#issuecomment-1211181940

我用了

sudo apt install aspnetcore-runtime-6.0=6.0.11-1 dotnet-apphost-pack-6.0=6.0.11-1 dotnet-host=6.0.11-1 dotnet-hostfxr-6.0=6.0.11-1 dotnet-runtime-6.0=6.0.11-1 dotnet-sdk-6.0=6.0.400-1 dotnet-targeting-pack-6.0=6.0.11-1

相关内容