OmniSharp在Visual Studio Code中启动失败

4

我在Kubuntu 15.04下使用VSCode(v.0.10.3)打开一个已存在的C# MSBuild项目文件夹(实际上是从VS 2012导出的)。启动后,OmniSharp报错:

[INFO] Starting OmniSharp at '/home/tezaurismosis/Development/NET/ConsoleApp/ConsoleApp.sln'...
[INFO] Started OmniSharp from '/home/tezaurismosis/VSCode/resources/app/extensions/csharp-o/bin/omnisharp' with process id 14956...
System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
    framework/System.Collections 
    framework/System.Collections.Concurrent 
    framework/System.Globalization 
    framework/System.IO 
    framework/System.Net.Http.WebRequest 
    framework/System.Reflection 
    framework/System.Runtime 
    framework/System.Text.Encoding 
    framework/System.Threading.Tasks 
Searched Locations:
... some paths ...
Try running 'dnu restore'.
at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) <0xb71f6a58 + 0x0035b> in <filename unknown>:0 
[ERROR] Error: Failed to start OmniSharp

我已经安装了最新版本的Mono(4.2.1)和所有的子包含Mono程序集,安装dnvm并运行dnvm upgrade -r mono,运行dnu restore,但是OmniSharp一次又一次地失败,而且在VSCode中没有智能感知。
请问我该如何解决这个问题?
备注:这不是ASP.NET,只是一个控制台C#项目。

我有一个类似的问题,但是在Linux(Debian 8)上。你能解决这个问题吗? - Animesh
@Nanda,我不行。也许在VSCode中,非ASP.NET项目还没有(尚未)得到支持,我不知道。 - tezaurismosis
1个回答

3
您的版本可能已经过时。请在 VS Code 中卸载并重新安装 C# 扩展。
  1. 按下 F1,输入 ext show installed,再按下 Enter。 点击 x 按钮进行删除。
  2. 重新启动 VS Code。
  3. 按下 F1,输入 ext install,再按下 Enter。 点击下载图标进行安装。
  4. 重新启动 VS Code。
现在 Omnisharp 将会运行。

这种前沿的东西很酷,但有时候也很痛苦。感谢提供简单的解决方案。它对我很有效 :) - joshmcode
你的回答很有用,谢谢。但是在我现在的代码版本中,在第一步之后会出现一个列表,其中包含“由Omnisharp提供支持的Visual Studio Code的C#”,点击即可更新。抱歉我的英语不好。 - Angel Angel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接