简体   繁体   中英

Omnisharp can't start dotnet

I am using VS Code and Unity.

Under the output tab (omnisharp log) I get this error

Starting OmniSharp server at 5/27/2022, 3:16:43 AM
    Target: /Users/<my.name>/unity/Test Project 3/Test Project 3.sln

[ERROR] Error: Command failed: dotnet --version
/bin/sh: dotnet: command not found

However, when I go the console, I can run dotnet --version just fine

dotnet --version
6.0.202

I now get the unity console telling me that the print command is invalid, but that error isn't highlighted in vs code.

Update: it seems to work if I open VS Code from the terminal. Doing research, it has something to do with the path. Still unsure why it doesn't normally work.

.Net SDKs are available at this path in Program Files: C:\Program Files\dotnet\sdk
Do you have this .net SDK path set in your 'Environment Variables' -> 'System variables' -> 'Path'? If not, try that.

In your terminal enter: where dotnet

Set this directory for omnisharp.dotnetPath in your VSCode preferences.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM