2019-03-29

在 Ubuntu 18.04.1 安裝 dotnet-sdk-2.2 出現依類項目不符無法安裝

markdown 將dotnet-sdk-2.2 安裝到 Ubuntu 18.04.1 時失敗。以 # 官網安裝方法(安裝失敗) [Install .NET Core SDK on Linux Ubuntu 18.04 - x64](https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current)
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2
安裝失敗,得到以下訊息 ``` Reading package lists... Done Building dependency tree Reading state information... Done 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.3) but it is not going to be installed Depends: dotnet-runtime-2.2 (>= 2.2.3) but it is not going to be installed E: Unable to correct problems, you have held broken packages. ``` # 依 [stackoverflow Derviş Kayımbaşıoğlu](https://stackoverflow.com/questions/54065894/cannot-install-net-core-2-2-on-ubuntu-18-04#answer-54065983) 的方式(安裝成功)
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

沒有留言:

adsense