在 ubuntu 中安装 dotnet 核心最终会发生依赖冲突

installing dotnet core in ubuntu end up having dependency conflicts

我之前确实在 ubuntu 中安装了 dotnetcore,没有任何问题。但有时我最终会遇到早期版本的依赖问题,但总是 ubuntu 20.04.

我正在遵循提供的指导 here

每当我尝试安装 sudo apt-get install dotnet-sdk-3.1 时,它都会显示依赖性问题:

The following packages have unmet dependencies:

dotnet-sdk-3.1 : Depends: dotnet-runtime-3.1 (>= 3.1.3) but it is not going to be installed

Depends: aspnetcore-runtime-3.1 (>= 3.1.3) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

我尝试一个一个地添加每个包,最终 sudo apt install dotnet-sdk-3.1 dotnet-runtime-3.1 aspnetcore-runtime-3.1 dotnet-runtime-deps-3.1

The following packages have unmet dependencies:
 dotnet-runtime-deps-3.1 : Depends: libicu but it is not installable or
                                    libicu63 but it is not installable or
                                    libicu60 but it is not installable or
                                    libicu57 but it is not installable or
                                    libicu55 but it is not installable or
                                    libicu52 but it is not installable

现在 apt-cache policy libicu(或任何 libicu63 等)显示没有安装候选。

libicu:
Installed: (none)
Candidate: (none)
Version table:

我不确定为什么会发生这种情况以及如何解决它。

这里正在讨论 - https://github.com/dotnet/core/issues/4616 (which is a duplicate of https://github.com/dotnet/core/issues/4360)

您可以执行以下解决方法:

步骤:

$ wget http://ftp.us.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u4_amd64.deb
$ sudo dpkg -i libicu57_57.1-6+deb9u4_amd64.deb
$ sudo apt install dotnet-sdk-3.1

$ dotnet --version
3.1.201

适合我