unity开发 OmniSharp启动踩坑

502 阅读1分钟

前情提要

配置unity和vscode开发环境的时候遇到了以下报错。

想要用vscode来写c#,打开c#文件时,启动OmniSharp时报错:

System.IO.FileNotFoundException: 检索 COM 类工厂中 CLSID 为 {177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D} 的组件失败,原因是出现以下错误: 8007007e 找不到指定的模块。

报错原因:

应该是缺少了某些dll之类的,我不清楚具体原因。

解决方法:

  1. 卸载已安装的visual studio各个版本。
  2. 用window install clean up(自己去下载)删除所有visual studio相关的程序。
  3. 重新安装visual studio 2019,勾选untiy游戏开发套件、NET开发套件等。
  4. 重启电脑。

参考

参考了github上这个问题的解决方法: .NET and Unity3D Intellisense stopped working. Omnisharp server fails to launch: System.IO.FileNotFoundException. · Issue #3215 · OmniSharp/omnisharp-vscode · GitHub