查看ubuntu版本:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
添加适配noble Ubuntu 24.04)的.NET 10源
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/ubuntu/24.04/prod****noble****main" | sudo tee /etc/apt/sources.list.d/microsoft-prod.list
#注意,上面的命令ubuntu/24.04需要与 Release版本一致,noble与具体的Codename一致
再次更新包索引,加载新添加的源
sudo apt update
安装.NET 10 SDK(包含完整的开发工具和运行时)
sudo apt install -y dotnet-sdk-10.0
dotnet -v
Welcome to .NET 10.0!
SDK Version: 10.0.100
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, run 'dotnet dev-certs https --trust'
Learn about HTTPS: https://aka.ms/dotnet-https
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet--v does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.