加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – vs代码的omnisharp扩展名出错

发布时间:2020-12-15 22:48:20 所属栏目:百科 来源:网络整理
导读:我一直在面对下一期的问题. 我从asp.net核心2.0和vs代码开始.我已经安装了omnisharp的VS Code 1.17.2,dotnet sdk 2.0和C#extension 1.13.0. 我创建了一个运行dotnet new mvc的mvc项目.当我打开vs代码时,我在整个.cs文件中遇到了很多错误. 我能够毫无问题地构
我一直在面对下一期的问题.
我从asp.net核心2.0和vs代码开始.我已经安装了omnisharp的VS Code 1.17.2,dotnet sdk 2.0和C#extension 1.13.0.
我创建了一个运行dotnet new mvc的mvc项目.当我打开vs代码时,我在整个.cs文件中遇到了很多错误.

enter image description here

我能够毫无问题地构建和运行应用程序.

enter image description here

此外,IntelliSense和调试工作正常.
当我看到错误选项卡时,我注意到很多其他错误:

The type ‘TargetFrameworkAttribute’ exists in both ‘System.Runtime,
Version=4.2.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a’ and
‘System.Runtime,Version=4.1.0.0,
PublicKeyToken=b03f5f7f11d50a3a’

enter image description here

我猜我的环境有问题,但我无法弄清楚是什么.任何想法都表示赞赏.

解决方法

看起来是一个与Omnisharp如何在Visual Studio 2017的本地安装中使用MSBuild相关的错误.如果您的VS安装已过期,您可能会看到此错误.

据推测,这个问题已经在VS Code的Omnisharp扩展的1.13.1版本中得到修复.

该票提到Visual Studio 2017 RTM是罪魁祸首,但有趣的是,我在15.2并且遇到了同样的问题.

有关其他详细信息,请参阅此处的错误凭单:github.com/OmniSharp/omnisharp-vscode/issues/1855

门票解决方案:

  1. Update VS 2017 – this is generally worthwhile anyway as there have been 4 updates since RTM.
  2. Download and use a version of OmniSharp with the a fix that will cause OmniSharp not to use VS 2017 RTM. You can follow the instructions here to do that.
  3. Install the last release of C# for VS Code (1.12.1) and change the “extensions.autoUpdate” to false.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读