You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04中dotnet run无法找到已安装的.NET 6运行时

.NET 6程序运行报错:缺失Microsoft.NETCore.App 6.0.0运行时

问题详情

Ubuntu自动更新并重启后,运行.NET 6程序时提示缺少对应框架。执行dotnet --list-sdks显示已安装SDK版本如下:

rami@rami-ThinkPad:~$ dotnet --list-sdks
3.1.426 [/usr/share/dotnet/sdk]
6.0.405 [/usr/share/dotnet/sdk]
7.0.102 [/usr/share/dotnet/sdk]

但执行dotnet run时出现报错:

dotnet run
Building...
You must install or update .NET to run this application.

App: /home/rami/th-work/internal-mkj-api/Internal-MKJ-API/bin/Debug/net6.0/Internal-MKJ-API
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
.NET location: /usr/share/dotnet

The following frameworks were found:
  3.1.32 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  7.0.2 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=ubuntu.22.04-x64

解决方案

方法1:直接安装.NET 6.0运行时

在终端执行以下命令安装对应运行时:

sudo apt update && sudo apt install dotnet-runtime-6.0

方法2:重新安装.NET 6 SDK(修复缺失的运行时组件)

如果安装运行时后问题仍存在,可重新安装.NET 6 SDK,确保SDK和配套运行时完整:

sudo apt update && sudo apt install --reinstall dotnet-sdk-6.0

验证修复结果

完成安装/修复后,可通过以下命令确认运行时已正确安装:

dotnet --list-runtimes

内容的提问来源于stack exchange,提问作者RamiR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 00:00:56