繁体   English   中英

Intellisense 在 VSCode 中不起作用 - OmniSharp 错误

[英]Intellisense not working in VSCode - OmniSharp Error

Intellisense 已停止为我工作,每当我运行 VSCode 时,OmniSharp 日志中都会出现此错误。

[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/leogaunt/Documents/Programming/Unity/Cube Stack/Assembly-CSharp.csproj'.
/Users/leogaunt/Documents/Programming/Unity/Cube Stack/Assembly-CSharp.csproj
/Users/leogaunt/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1178,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/leogaunt/Documents/Programming/Unity/Cube Stack/Assembly-CSharp.csproj

我已经尝试重新安装插件,并重新安装 VSCode,但它没有奏效。

我知道我安装了 .NET Core,因为我是 Mac 用户,我知道这一点是因为当我在终端中键入dotnet --version时,它会输出:

3.1.401

我在 Unity 中编程,正在为 iOS 创建游戏。

在 C# 扩展配置中,将 mono 路径更改为始终。

从 git 存储库获取 Unity 后,我遇到了同样的问题。 对我来说,它可以在 Unity 中重置 .Net 版本。 编辑 -> 项目设置 -> Api 兼容级别

来回切换,重新启动VSCode。 .csproj 文件将归档所有丢失的 dll。

相信我,它会起作用,尝试了一切,然后来到这个

  1. Go 进入 VS 代码首选项
  2. 搜索omnisharp.path并点击settings.json中的编辑
  3. 添加/编辑行"omnisharp.path": "latest" (记得在上一行的末尾添加一个逗号)
  4. Go 回到设置并搜索omnisharp ,向下滚动直到找到Use Global Mono ,将其更改为Always
  5. 在此之后,您将不得不下载Mono ,mac的 mono 下载链接是这个https://www.mono-project.com/download/stable/#download-mac
  6. 下载完成后,打开下载文件进行设置
  7. Go 回到 settings.json 并添加单声道的 /bin 路径为“omnisharp.monoPath”:“/Library/Frameworks/Mono.framework/Versions/6.12.0/bin” ,这是mac的默认下载路径,如果你想确认的话这个,go进入mac的磁盘空间然后按照上面提到的路径)
  8. 最后重新启动VS Code ,它应该可以工作(如果它仍然没有,请再次重新启动它)

我通过卸载所有 SDK 并安装较旧的4.7.1 解决了这个问题,然后一切都立即运行。

该错误表明 OmniSharp 正在寻找Version=v4.7.1 您可能想要安装它的最新版本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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