Omnisharp-vscode: .NET CLI tools cannot be located (but are on path)

Created on 10 Jul 2016  路  11Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64

VS Code version:
version 1.3.0

C# Extension version:
version 1.2.2

Steps to reproduce

  1. Install latest Visual Studio Code
  2. Install .NET CLI tools
  3. Confirm that .NET CLI tools are on path:

cat $PATH
cat: /Library/Android/android-sdk-mac_x86/build-tools/21.1.1:/Library/Android/android-sdk-mac_x86/tools:/Library/Android/android-sdk-mac_x86/platform-tools:/Users/robert/.rbenv/plugins/ruby-build/bin:/Users/robert/.rbenv/shims:/Users/robert/.rbenv/bin:/Users/robert/Development/Go/bin:/Users/robert/Library/CustomCommands:/Library/Android/android-sdk-mac_x86/platform-tools:/Library/Android/android-sdk-mac_x86/tools:/Library/Android/android-sdk-mac_x86:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/dotnet:/Users/robert/.rvm/bin: No such file or directory

  1. Open C# project in VS Code

Expected behavior

C# plugin features should be enabled

Actual behavior

Error message indicates that .NET CLI tools cannot be located.
screen shot 2016-07-10 at 5 49 40 pm

Debugger-Install

Most helpful comment

It appears that your PATH is not available to Finder/Dock-launched applications unless you explicitly set it up to be, as per http://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications

Essentially you need to:

  1. Add launchctl setenv PATH $PATH to your .bash_profile or .bashrc
  2. Restart the Dock using osascript -e 'tell app "Dock" to quit' in order to make the changes take effect
  3. Restart Visual Studio Code

All 11 comments

Experiencing Same Issue. Same Message, but running on Windows 7.

@robertpeacock22 I suspect the issue is that your path variable is malformed. We should handle this better, but in the meantime can you try removing : No such file or directory from your $PATH?

@JeremyBYU What does your %PATH% variable look like?

Heres what my path says

C:\Users\jeremy_castagnodev>echo %path%
C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:
\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\Syst
em32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\blp\API;C:\blp\API\dde;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program File
s (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\I
ntel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) M
anagement Engine Components\IPT;C:\Program Files\Git\cmd;C:\Program Files\Micros
oft\Web Platform Installer\;C:\Program Files (x86)\NSIS;C:\Software\pdf2htmlEX;C
:\Software\pdf2htmlEX\data;C:\Python27;C:\Program Files (x86)\Windows Kits\8.1\W
indows Performance Toolkit\;%NVM_HOME%;%NVM_SYMLINK%;C:\Program Files\dotnet\;C:
\Users\jeremy_castagnodev\AppData\Local\atom\bin;C:\Users\jeremy_castagnodev\App
Data\Local\.meteor\;C:\Users\jeremy_castagnodev\AppData\Roaming\npm;C:\Program F
iles\MongoDB\Server\3.2\bin;C:\Program Files\Docker Toolbox;C:\Users\jeremy_cast
agnodev\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Micro
soft VS Code\bin

I can execute dotnet just fine on the command line.

C:\Users\jeremy_castagnodev>dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
 Version:            1.0.0-preview2-003121
 Commit SHA-1 hash:  1e9d529bc5

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.1.7601
 OS Platform: Windows
 RID:         win7-x64

C:\Users\jeremy_castagnodev>

Thanks!

@JeremyBYU I would guess that you can work around this problem until we get out a fix by removing the entries %NVM_HOME%;%NVM_SYMLINK%

@gregg-miskelly I am still having this issue.
dotnet-info output:

.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64

VS Code version:
version 1.3.1

C# Extension version:
version 1.3.0

I have tried:

  • restarting Visual Studio Code
  • uninstalling/reinstalling the C# Extension
  • restarting my macbook

With regard to the "No such file or directory" issue noted above, this may just be an issue with using cat $PATH as it does not appear when I echo $PATH.

@robertpeacock22 I would suggest opening a new issue. As of 1.3.x of the VS Code extension, we no longer try to parse PATH so this means that either node or the operating system itself cannot find dotnet when VS Code launches it. But we can try and to troubleshoot why it isn't on your path.

It appears that your PATH is not available to Finder/Dock-launched applications unless you explicitly set it up to be, as per http://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications

Essentially you need to:

  1. Add launchctl setenv PATH $PATH to your .bash_profile or .bashrc
  2. Restart the Dock using osascript -e 'tell app "Dock" to quit' in order to make the changes take effect
  3. Restart Visual Studio Code

@robertpeacock22 makes sense. But the weird thing is that it seems like whatever the CLI installer is doing is working for most folks. @blackdwarf do you know how the CLI installer adds dotnet to the path?

If this is macOS, then we use the path_helper support by placing a file with the installation path in the /etc/paths.d directory.

@robertpeacock22 which shell are you using?

@blackdwarf I'm using bash.

Was this page helpful?
0 / 5 - 0 ratings