10

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?

5
  • The question's not very clear - please see How to Ask. Commented May 21, 2018 at 17:58
  • It is in the Visual Studio at runtime. Commented May 21, 2018 at 18:03
  • 1
    You're sure you're not running Visual Studio Code? Commented May 21, 2018 at 18:18
  • oh, sorry it was visual studio code Commented May 21, 2018 at 18:19
  • did you restart VSCode after you installed CLI tools? Commented May 21, 2018 at 18:23

7 Answers 7

24

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/
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. Didn't know that VS Code looks in specific dir. So for snap users: sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/
18

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

2

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

Comments

2

File>Preferences>Settings

"csharp.suppressDotnetInstallWarning": true,

It was worked for me enter image description here

Comments

1

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

1 Comment

@DmitryDronov it's a hidden file in your home directory, if you put it in .bashrc or your equivalent rc file for your shell should also be fine. You might need to logout or source that file after you've done that.
1

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/

Comments

0

For Arch

$ sudo ln -s /opt/dotnet/sdk /usr/bin/sdk

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.