使用Snap安装后,发现无法找到`dotnet`命令。

我在我的Ubuntu 18.04上使用"sudo snap install dotnet-sdk --classic"安装了.NET Core,但是安装过程完成后,"dotnet"命令仍然无法正常工作。 这是我的控制台日志:
long@long-ub1804:~$ sudo snap install dotnet-sdk
[sudo] password for long: 
error: This revision of snap "dotnet-sdk" was published using classic
       confinement and thus may perform arbitrary system changes outside of the
       security sandbox that snaps are usually confined to, which may put your
       system at risk.

       If you understand and want to proceed repeat the command including
       --classic.
long@long-ub1804:~$ sudo snap install dotnet-sdk --classic
dotnet-sdk 2.2.202 from Microsoft .NET Core (dotnetcore✓) installed
long@long-ub1804:~$ dotnet --version

Command 'dotnet' not found, but can be installed with:

sudo snap install dotnet-sdk

long@long-ub1804:~$ snap list
Name                  Version                    Rev   Tracking  Publisher    Notes
chromium              73.0.3683.86               669   stable    canonical✓   -
core                  16-2.38                    6673  stable    canonical✓   core
core18                18                         782   stable    canonical✓   base
docker                18.06.1-ce                 321   stable    canonical✓   -
dotnet-sdk            2.2.202                    32    stable    dotnetcore✓  classic
gnome-3-26-1604       3.26.0.20190228            82    stable/…  canonical✓   -
gnome-3-28-1804       3.28.0-9-gce87599.ce87599  23    stable    canonical✓   -
gnome-calculator      3.32.0+git2.cae338ea       352   stable/…  canonical✓   -
gnome-characters      v3.32.0+git1.9ff74a2       206   stable/…  canonical✓   -
gnome-logs            3.32.0                     57    stable/…  canonical✓   -
gnome-system-monitor  3.32.0                     70    stable/…  canonical✓   -
gtk-common-themes     0.1-16-g2287c87            1198  stable/…  canonical✓   -
pycharm-community     2019.1.1                   123   stable    jetbrains✓   classic
long@long-ub1804:~$ 


1从命令行中运行应用程序,使用dotnet-sdk.dotnet - Terrance
1个回答

你应该尝试以下命令:
sudo snap alias dotnet-sdk.dotnet dotnet
因为snap不会自动为dotnet-sdk提供别名。
祝好,

8软件包管理器来了又走,有些长久留存,有些则不然。然而,它们在最基本的任务上最终都会出现令人瞩目的失败。感谢你的建议。 - Pedro Rodrigues
3我听说过,如果不进行一些额外的配置,Visual Studio Code仍然会出现一些问题。 - Alex Hope O'Connor
3不要使用snap来安装dotnet。它只能部分工作,而且vs code无法正常运行。而且卸载它也很麻烦。 - Calanus
3还有,不要使用Ubuntu软件更新器来更新dotnet,因为它会使用snap,你会像我刚刚做的那样浪费一整天的时间。 - JBSnorro