Omnisharp-vscode: .net CLI tools cannot be located. dotnet command does not run in VSCode but does in external cmd

Created on 3 Dec 2018  路  7Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output: 2.1.500
VS Code version: 1.29.1
C# Extension version: 1.17.1

Steps to reproduce

Already have VS Code installed, previously used more for Javascript work.
Also have .net framework sdk 4.5.1 and 4.6 installed.
Install .net core x64 2.1.500.
Already had C# extension installed.
Try dotnet new command. Dotnet not recognized with internal powershell or cmd.
Re-installed c# extension.
Re-installed .net core

Expected behavior

For the dotnet command to work on the internal terminal in both cmd and powershell. Also for .net core debugging to be enabled and working.

Actual behavior

dotnet command is not recognized inside VS Code, yet it is on external cmd.
Always get the error in VS code that .net CLI tools cannot be located

Question

Most helpful comment

Yeah, that was it. I just restarted the computer and it is now working fine! Didn't even think of it these days. Sorry to waste your time!

All 7 comments

This is really a VS Code issue rather than an issue with the C# extension, but we can see if we can help a little.

You are on Windows I assume?
If you start VS Code from a command prompt with 'dotnet.exe' on your path do you see the same problem?
Can you share the value of your path environment variable?

Sorry, I was just googling the problem and I ended up on here.
Yes, Windows 10.
It seems if I run VS code from the command prompt dotnet is on the path, whereas it isn't if I run VS code from the standard shortcut or by right-clicking on a folder to open in VSCode.
I'm not sure why the path is missing dotnet unless it is run from the cmd?
The normal path is:
PATH=C:Program Files (x86)Common FilesOracleJavajavapath;C:ProgramDataOracleJavajavapath;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Userszief.dnxbin;C:Program FilesMicrosoft DNXDnvm;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program FilesGitcmd;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:Program Files (x86)AOMEI Backupper;C:Program Files (x86)Bracketscommand;C:WINDOWSSystem32OpenSSH;C:Program FilesMicrosoft VS Codebin;C:Program FilesTortoiseGitbin;C:Program Files (x86)Yarnbin;C:Program Filesnodejs;C:Program Filesdotnet;C:UsersziefAppDataLocalMicrosoftWindowsApps;C:Program FilesMicrosoft VS Codebin;;C:UsersziefAppDataLocalProgramsMicrosoft VS Codebin;C:UsersziefAppDataLocalYarnbin;C:UsersziefAppDataRoamingnpm;C:Userszief.dotnettools

I don't see anything about your path that looks particularly unusual.

Have you installed the .NET Core SDK recently? (ex: since the last time you rebooted) I have occasionally seen some folks complain about path settings not updating after installing the .NET Core SDK.

If that isn't it, can you compare that path to the path you have in the VS Code integrated terminal in case that sparks any ideas?

Yeah, that was it. I just restarted the computer and it is now working fine! Didn't even think of it these days. Sorry to waste your time!

Excellent! Glad you solved your problem.

thank you very much it solved

Thank you

Was this page helpful?
0 / 5 - 0 ratings