我最近将Ubuntu发行版从20更新到22.04,现在看来我无法正确安装dotnet-sdks。我已经用6安装了dotnet,但我现在需要3.1,我不记得我是如何用dotnet 6安装的。
以下是我所做的。
$ wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
$ rm packages-microsoft-prod.deb
$ sudo apt-get update
$ sudo apt-get install dotnet-sdk-3.1
所有这些命令都成功地完成了。apt-get找到了dotnet-sdk包并安装了它。但是,当我调用dotnet --list-sdks
时,我看不到3.1。
所以我的想法是,也许dotnet的安装方式不同,找不到使用apt-get安装的SDK(下面,我在我的机器上提供了一些dotnet安装的调试信息(。但如果是这种情况,那么我该如何安装它们呢?我在网上看到的每一个地方都告诉我只使用包管理器或快照,但这些都不起作用。
调试信息
一些有用的(让我知道我是否应该包括更多(调试信息。
$ whereis dotnet
dotnet: /usr/bin/dotnet /usr/lib/dotnet /etc/dotnet /usr/share/dotnet /usr/share/man/man1/dotnet.1.gz
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.109
Commit: 58a93139d8
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/lib/dotnet/dotnet6-6.0.109/sdk/6.0.109/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: x64
Commit: 163a63591c
.NET SDKs installed:
6.0.109 [/usr/lib/dotnet/dotnet6-6.0.109/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [/usr/lib/dotnet/dotnet6-6.0.109/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
$ sudo apt show dotnet -a
Package: dotnet
State: not a real package (virtual)
N: Can't select versions from package 'dotnet' as it is purely virtual
N: No packages found
$ sudo apt show dotnet-sdk-3.1 -a
Package: dotnet-sdk-3.1
Version: 3.1.424-1
Priority: standard
Section: devel
Maintainer: Microsoft <dotnetcore@microsoft.com>
Installed-Size: 198 MB
Depends: libc6 (>= 2.14), libgcc1 (>= 1:3.0), libstdc++6 (>= 4.6), dotnet-targeting-pack-3.1 (>= 3.1.0), netstandard-targeting-pack-2.1 (>= 2.1.0), dotnet-apphost-pack-3.1 (>= 3.1.30), aspnetcore-targeting-pack-3.1 (>= 3.1.10), dotnet-runtime-3.1 (>= 3.1.30), aspnetcore-runtime-3.1 (>= 3.1.30)
Homepage: https://dotnet.github.io/core
Download-Size: 49.8 MB
APT-Manual-Installed: yes
APT-Sources: https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages
Description: Microsoft .NET Core SDK 3.1.424
.NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.
Package: dotnet-sdk-3.1
Version: 3.1.423-1
Priority: standard
Section: devel
Maintainer: Microsoft <dotnetcore@microsoft.com>
Installed-Size: 198 MB
Depends: libc6 (>= 2.14), libgcc1 (>= 1:3.0), libstdc++6 (>= 4.6), dotnet-targeting-pack-3.1 (>= 3.1.0), netstandard-targeting-pack-2.1 (>= 2.1.0), dotnet-apphost-pack-3.1 (>= 3.1.29), aspnetcore-targeting-pack-3.1 (>= 3.1.10), dotnet-runtime-3.1 (>= 3.1.29), aspnetcore-runtime-3.1 (>= 3.1.29)
Homepage: https://dotnet.github.io/core
Download-Size: 49.8 MB
APT-Sources: https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages
Description: Microsoft .NET Core SDK 3.1.423
.NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs.
没有官方支持低于6.0的版本。
下表是当前支持的列表。NET版本和他们支持的Ubuntu版本。
Ubuntu .NET
22.04 (LTS) 6+
20.04 (LTS) 3.1, 6
18.04 (LTS) 3.1, 6
16.04 (LTS) 3.1, 6
在同一页面上,您可以找到一张纸币
Ubuntu 22.04包含OpenSSL 3作为基线版本。净6支持早期版本的OpenSSL 3。NET版本没有。微软不测试或支持在Ubuntu 22.04上使用OpenSSL 1.x。了解更多信息信息,请参阅。NET 6安全性改进。
解释是最新的LTS将OpenSSL库从v1.1.x切换到v3.0.0。
第页。S.这里还有一篇文章说,人们不应该害怕迁移到dotnet6
请开始将您的应用程序迁移到。NET 6。NET 5应用程序。我们从早期采用者那里听说,升级到。NET 6是直接来自。NET Core 3.1和。NET 5。