简体   繁体   English

Omnisharp 无法启动 dotnet

[英]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.

相关问题 Omnisharp 无法为我的文件找到文档 - Omnisharp can't find document for my file 即使统一构建,omnisharp 也找不到命名空间 - namespace can't be found by omnisharp even though unity builds 截至今天,omnisharp 无法正常启动(无法从程序集中加载“CheckForDuplicateFrameworkReferences”任务 [...]) - As of today omnisharp doesn't start properly (The “CheckForDuplicateFrameworkReferences” task could not be loaded from the assembly […]) 无法卸载工具 dotnet - Can't uninstall tool dotnet OmniSharp无法在Visual Studio Code中启动 - OmniSharp failed to start in Visual Studio Code vscode omnisharp intellisense 不适用于 dotnet 5.0(目标 net5.0) - vscode omnisharp intellisense not working with dotnet 5.0 (target net5.0) VS Code / OmniSharp 无法加载项目; 找不到存在的 package - VS Code / OmniSharp failing to load project; Can't find a package that is present dotnet核心:无法运行单元测试 - dotnet core: can't run unit tests Ubuntu 16.10上的OmniSharp-VIM,OmniSharp-Roslyn和dotnet核心 - 语法检查无法识别C#6并需要解决方案文件 - OmniSharp-VIM, OmniSharp-Roslyn, and dotnet core on Ubuntu 16.10 - Syntax checking not recognizing C# 6 and requires solution file 无法启动 OmniSharp,因为需要 Mono 版本 &gt;=6.4.0 - Cannot start OmniSharp because Mono version >=6.4.0 is required
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM