[英]Omnisharp can't start dotnet
I am using VS Code and Unity.我正在使用 VS Code 和 Unity。
Under the output tab (omnisharp log) I get this error在 output 选项卡下(omnisharp 日志)我收到此错误
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但是,当我 go 控制台时,我可以运行 dotnet --version 就好了
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.我现在得到统一控制台告诉我打印命令无效,但是在 vs 代码中没有突出显示该错误。
Update: it seems to work if I open VS Code from the terminal.更新:如果我从终端打开 VS Code,它似乎可以工作。 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 .Net SDK 位于 Program Files 中的此路径:C:\Program Files\dotnet\sdk
Do you have this .net SDK path set in your 'Environment Variables' -> 'System variables' -> 'Path'?您是否在“环境变量”->“系统变量”->“路径”中设置了这个 .net SDK 路径? If not, try that.
如果没有,请尝试。
In your terminal enter: where dotnet
在您的终端中输入:
where dotnet
Set this directory for omnisharp.dotnetPath
in your VSCode preferences.在 VSCode 首选项中为
omnisharp.dotnetPath
设置此目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.