无法在 UBuntu 18.04 上安装 .Net Core 2.2

Cannot install .Net Core 2.2 on UBuntu 18.04

我试图将 ASP.NET Core 2.2 应用程序部署到 DigitalOcean 液滴 运行 Ubuntu 18.04。我按照 official documentation.

上提供的步骤操作

但是我收到了错误。

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 dotnet-sdk-2.2 : Depends: aspnetcore-runtime-2.2 (>= 2.2.0) but it is not going to be installed
                  Depends: dotnet-runtime-2.2 (>= 2.2.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

  

有什么帮助吗?我试图从其他论坛获得帮助,但仍然没有成功。

这是 GitHub

上的一个已知问题

据我所知,开发人员提出了不同的解决方案。我建议你检查 link.

问题一般是缺少libicu。 libicu的版本在哪里

以下是针对DotNet-Core Sdk版本的建议解决方案dotnet-sdk-2.2

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2
 

我遇到了同样的问题。上面的修复对我来说并没有真正起作用。我必须下载并安装 libicu57libssl1.0.0 才能执行 运行 的命令并成功安装 .net。

libicu57
libssl1.0.0

下载特定版本.net sdk,你的可能不一样

安装后,运行

sudo apt-get install dotnet-sdk-2.2

希望这有帮助。

解决方法在这里Download and install libicu..

我手动复制了列表并且它起作用了:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update

sudo apt-get install dotnet-sdk-2.2