sdk icon indicating copy to clipboard operation
sdk copied to clipboard

can use dotnet in command but cannot be located in vscode on mac os

Open yuzd opened this issue 10 years ago • 27 comments

image

sorry my english is not good.so i upload a pic to show my probleam. the point is .i update to the new .net core sdk. i add to the PATH .and i can use dotnet new dotnet restore dotnet run in the command. but when i open the project in vscode. the cli tools cannot be located error happen.

Environment data

dotnet --info output: bash-3.2$ dotnet --info .NET Command Line Tools (1.0.0-preview3-003180)

Product Information: Version: 1.0.0-preview3-003180 Commit SHA-1 hash: d4193cd5c1

Runtime Environment: OS Name: Mac OS X OS Version: 10.11 OS Platform: Darwin RID: osx.10.11-x64 bash-3.2$ dotnet run Project hello (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation. Hello World!

Console

//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:88 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.e.doShow @ //Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:88

I tried above .but not solved. use command+P.and enter >Download .Net core Debugger likes nothing hanppen . the console also have no error message.

Append

image i can use dotnet restore in command. but when i use Command+p and enter >dotnet restore then "/bin/sh"

image

image

yuzd avatar Jul 13 '16 23:07 yuzd

Try closing vscode completely and then restarting it. If you updated the CLI tools while vscode was open, vscode likely did not load the updated $PATH environment variable.

tonyferreira avatar Jul 15 '16 15:07 tonyferreira

@tonyferreira i restart my pc. but /bin/sh:dotnet command not found error not solved. and i upload another pic to show that.

yuzd avatar Jul 15 '16 16:07 yuzd

@yuzd I just tried it but I exited VS Code with Cmd-Q (or Code -> Quit VS Code from the menu bar). After restarting VS Code it actually worked. Can you try that?

thesmithee avatar Jul 18 '16 23:07 thesmithee

@blackdwarf thanks for comment。 I tried that.but failed. my vs code can not use dotnet command.so i tried this:

➜ ~ which dotnet /usr/local/bin/dotnet

i copy the dotnet file from [/usr/local/bin/dotnet] to the project folder. then debugger working.

image

but when start debugger. then show me to enter pc password.does vs code have no permissions for dotnet cli command? image

image

but this was not expected. how to let vs code read dotnet cli command Automatic ?

yuzd avatar Jul 19 '16 00:07 yuzd

What is the version of the SDK you have installed? You can find this out by running dotnet --version from the terminal.

Thanks, Z

Sent from my tricorder

On Mon, Jul 18, 2016 at 5:40 PM -0700, "鱼东东" <[email protected]mailto:[email protected]> wrote:

@blackdwarfhttps://github.com/blackdwarf thanks for comment。 I tried that.but failed. my vs code can not use dotnet command.so i tried this:

? ~ which dotnet /usr/local/bin/dotnet

i copy the dotnet file from [/usr/local/bin/dotnet] to the project folder. then debugger working.

[image]https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fcloud.githubusercontent.com%2fassets%2f16083659%2f16934723%2fb01ff0c4-4d8b-11e6-9662-c143d77e9222.png&data=01%7c01%7cZlatko.Knezevic%40microsoft.com%7c2f28adb66a7b4d71ced708d3af6d36f1%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=a7MZfVayhoJv0KS3pnfVIc%2fUqS2ZmGjFLJSPI5X%2fIqU%3d

but this was not expected. i need help.

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/cli/issues/3858#issuecomment-233499994, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AC-H_Acu4gBkycZ4weLXo8MmEbk5Tfexks5qXBzcgaJpZM4JL8SB.

thesmithee avatar Jul 20 '16 00:07 thesmithee

@blackdwarf ➜ ~ which dotnet /usr/local/bin/dotnet ➜ ~ dotnet --version 1.0.0-preview3-003180

Thanks for helping!

yuzd avatar Jul 21 '16 00:07 yuzd

The same issue for me with 1.0.0-preview2-003121 on Mac OSX

I've installed nvm much earlier than dotnet

I read this issue from the OmniSharp repository, so I tried by removing the nvm related scripts from my profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc), this workaround is working in my case

leonplata-old avatar Jul 24 '16 17:07 leonplata-old

The same issue for me on Win7

dotnet --version

Product Information:            
 Version:     1.0.0-beta-001598 
 Commit Sha:  7582649f88        

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

vscode version

1.3.1

tobyee avatar Jul 27 '16 05:07 tobyee

@DustinCampbell

TheRealPiotrP avatar Jul 27 '16 09:07 TheRealPiotrP

cc @gregg-miskelly as well

DustinCampbell avatar Jul 27 '16 10:07 DustinCampbell

@Tobyee you have a very old version of the dotnet tools. Can you please install the latest and see if it repros again?

thesmithee avatar Jul 27 '16 15:07 thesmithee

@leonplata thank you very mush. I removed the nvm from the ~/.zshrc . then solved!

But i can not use node command .do you have any idea for that?

yuzd avatar Jul 28 '16 00:07 yuzd

@blackdwarf The problem solved, see

https://github.com/OmniSharp/omnisharp-vscode/issues/627#issuecomment-235816230

tobyee avatar Jul 28 '16 07:07 tobyee

This issue is still happening with the latest version of Visual Studio Code on macOS.

bandrei avatar Jul 09 '18 07:07 bandrei

@bandrei If you are only seeing this problem in VS Code (not a terminal window), the problem is likely to be that you have something configured with your shell that break's VS Code's ability to scrape environment variables. There are troubleshooting steps in https://github.com/Microsoft/vscode/issues/21655 that you may find useful.

gregg-miskelly avatar Jul 09 '18 17:07 gregg-miskelly

I would've thought that might be the case, however whenever I run env I do see the path to dotnet being set correctly to /usr/local/share/dotnet. I opened another issue with the Azure Functions Extension because I think that's where the problem is (i.e. it doesn't know where on the path to look for the SDK)

bandrei avatar Jul 10 '18 07:07 bandrei

ok, so the omnisharp server is starting correctly after running dotnet restore from VSCode. I guess that's needed to install the project depdencies locally. However the missing .NET cli error is still there.

bandrei avatar Jul 10 '18 07:07 bandrei

further tracked it down to

> Executing task: dotnet clean <

/bin/bash: dotnet: command not found
The terminal process terminated with exit code: 127

Terminal will be reused by tasks, press any key to close it.

It does look like the task execution is not picking up the environemnt variables

bandrei avatar Jul 10 '18 07:07 bandrei

Ok, I have absolutely no idea what happened (it might have been my empty dev.env) file that messed up the path after omnisharp started working, however I restarted and updated VSCode and things are working now.

bandrei avatar Jul 10 '18 07:07 bandrei

@bandrei check your ~/.bash_profile and comment out items one by one. In my case, the problem was caused after I added export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"

Miggleness avatar Jul 19 '18 05:07 Miggleness