Visual Studio Code tells me "The .NET CLI tools cannot be located. .NET Core debugging will not be enabled. Make sure .NET CLI tools are installed and are on the path.". This prevents any code completion ect. can I fix this issue?
Sometimes the Visual Studio warning will still persist even after installing the .NET SDK. This is because a link/shortcut/alias needs to be created between the .NET executable install location and the Visual Studio path.
The executable was most likely installed in /usr/local/share/dotnet/dotnet
. A symbolic link needs to be created to usr/local/bin
for Visual Studio.
To create that link assuming the locations above use this in the Terminal:
$ ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
For Ubuntu & Snap use this instead:
$ sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/
After you've installed CLI tools (called ".NET SDK") , try restarting VSCode. This will allow VSCode to load the updated $PATH
environment variable. VSCode "Reload Window" command will not help in this case.
on mac I added the following paths to /etc/paths
/usr/local/share/dotnet
/usr/local/share/dotnet/sdk
/usr/local/share/dotnet/sdk/2.2.101
To install the dotnet-cli with snap:
snap install code --classic
snap alias dotnet-sdk.dotnet dotnet
Add at the end of .profile
:
export DOTNET_ROOT=/snap/dotnet-sdk/current export
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
For Linux Solus 4:
Install vscode in Package manager
Install dotnet:
sudo snap install dotnet-sdk --classic
sudo snap alias dotnet-sdk.dotnet dotnet
sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/bin/
拱门用
$ sudo ln -s /opt/dotnet/sdk /usr/bin/sdk
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.