我下载了./dotnet-install.sh并成功安装:
$ ./dotnet-install.sh -c Current
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.
dotnet-install: .NET Core SDK version 5.0.207 is already installed.
dotnet-install: Adding to current process PATH: `/home/tesla/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
我添加了路径
└─$ 导出 PATH=$PATH:/home/tesla/.dotnet
dotnet --版本 5.0.207
我有两个问题:
首先,每次重新启动电脑时,我都需要重新安装 第二个 vs code 终端看不到 dotnet --version 命令:
"Command 'dotnet' not found, but can be installed with:
sudo snap install dotnet-sdk # version 5.0.401, or
sudo apt install dotnet-host
See 'snap info dotnet-sdk' for additional versions. "
如果我在 vscode 终端上设置路径,重新启动 vscode 后,它无法识别 dotnet 命令
答案1
您需要将 PATH 添加到 ~/.profile 或 ~/.bashrc 文件中。
PATH=$PATH:/home/tesla/.dotnet
立即更新更改
source ~/.profile
or
source ~/.bashrc
答案2
您可以手动安装 dotnet :
1- 通过安装 tarball:
wget https://dotnetcli.azureedge.net/dotnet/Sdk/5.0.207/dotnet-sdk-5.0.207-linux-x64.tar.gz
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet-sdk-5.0.207-linux-x64.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
2-通过安装.deb文件
您可以下载该.deb
文件从这里,例如,克:
wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb