csharp安装

csharp 的安装和排错.

.NET 和 Ubuntu 概述 - .NET | Microsoft Learn 通常 ubuntu 22.04 以及以上版本自带.

1
2
3
4
5
# 搜索
apt search dotnet

# 安装这个整合包即可
apt install dotnet7

如果使用过程中出现无法找到 sdk, runtimes, libhostfxr 相关的信息, 是因为你混用了 微软官方Ubuntu官方 包.

1
2
3
4
5
6
7
# 卸载
apt remove 'dotnet*' 'aspnet*' 'netstandard*'
# 移除微软残酷
rm -f /etc/apt/sources.list.d/microsoft-prod.list
apt update -y
# 重新安装
apt install dotnet7

可以参考官方文档 排查 Linux 上的 .NET 包混杂问题 - .NET | Microsoft Learn