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?
-
The question's not very clear - please see How to Ask.EJoshuaS - Stand with Ukraine– EJoshuaS - Stand with Ukraine2018-05-21 17:58:07 +00:00Commented May 21, 2018 at 17:58
-
It is in the Visual Studio at runtime.Alice Edwards– Alice Edwards2018-05-21 18:03:32 +00:00Commented May 21, 2018 at 18:03
-
1You're sure you're not running Visual Studio Code?trix– trix2018-05-21 18:18:07 +00:00Commented May 21, 2018 at 18:18
-
oh, sorry it was visual studio codeAlice Edwards– Alice Edwards2018-05-21 18:19:16 +00:00Commented May 21, 2018 at 18:19
-
did you restart VSCode after you installed CLI tools?trix– trix2018-05-21 18:23:08 +00:00Commented May 21, 2018 at 18:23
7 Answers
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/
1 Comment
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.
Comments
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
