按微软官方的流程安装dotnet-sdk-2.2出错了,提示“无法定位软件包 dotnet-sdk-2.2”
原因: 问题的原因估计是安装packages-microsoft-prod.deb时出问题了,并没有把源和密钥添加到/etc/apt中 解决办法: 用dpkg解压packages-microsoft-prod.deb 解压文件夹中打开有etc,etc下有apt目录,apt下有sources.list.d和trusted.gpg.d,下有microsoft-prod.list和microsoft.prod.gpg 把microsoft-prod.list的内容,这句 “deb [arch=amd64] bionic main” 复制到/etc/apt/sources.list中, 然后把microsoft-prod.gpg文件复制到/etc/apt/trusted.gpg.d/下。 然后: sudo apt update sudo apt install dotnet-sdk-2.2 完整操作:$cd ~$wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb$dpkg -x packages-microsoft-prod.deb packages-microsoft-prod$sudo vim /etc/apt/sources.list#添加:deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main$sudo cp ~/packages-microsoft-prod/etc/apt/trusted.gpg.d/microsoft-prod.gpg /etc/apt/trusted.gpg.d/$sudo apt update$sudo apt install dotnet-sdk-2.2