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

如何修复Linux上损坏的.NET 7.0/8.0 SDK安装

.NET SDK故障排查问题

背景

此前在Pop!_OS 22.04 LTS x86_64系统上安装的.NET 7.x运行正常,可构建运行C#项目、安装Husky.NET、versionize等dotnet工具。尝试升级至.NET 8.0失败后,进行了一系列操作:卸载.NET 8、通过dotnet-install.sh脚本手动安装.NET 8、再次卸载.NET 8及.NET 7.0、手动删除~/.dotnet、/usr/lib/dotnet/等目录下的dotnet SDK文件与/usr/bin/dotnet软链接、从微软及Ubuntu软件源重装.NET 7.0。

当前系统状态

$ whereis dotnet 
dotnet: /usr/bin/dotnet /usr/lib/dotnet /etc/dotnet /usr/share/dotnet /usr/share/man/man1/dotnet.1.gz
$ which dotnet
/usr/bin/dotnet
$ dotnet
Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help         Display help.
  --info            Display .NET information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.

path-to-application:
  The path to an application .dll file to execute.

异常现象

  • 运行dotnet --version提示找不到.NET SDK;
  • dotnet --info显示仅安装了.NET 7.0.14运行时,无SDK;
  • dotnet --list-sdks无输出,dotnet --list-runtimes显示存在Microsoft.AspNetCore.App 7.0.14与Microsoft.NETCore.App 7.0.14;
  • 执行dotnet build同样提示找不到SDK,无法构建项目。

疑问

  1. 我遗漏了什么环节?
  2. .NET SDK的部署位置与机制有哪些细节能帮助排查此问题?
  3. 还有哪些可行的故障排查操作?

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 05:45:20