【问题标题】:VSCode "you must add a reference to assembly 'netstandard'" but compiles fineVSCode“您必须添加对程序集'netstandard'的引用”但编译得很好
【发布时间】:2020-10-20 15:03:42
【问题描述】:

我不经常重启我的电脑,今天早上也重启了。当 VSCode 启动时,它看起来好像做了更新,现在 IDE 抱怨错误。

我的应用程序仍然可以正常编译和运行,但在 IDE 中,我看到 30k 错误都显示类似于以下内容:

'The type XXXXXX is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [MyApp.Application]'

看来omnisharp是最晚的。

我也在 Mac 上。

【问题讨论】:

  • 你在做什么样的项目? .NET 框架、标准、核心,...?你在本地安装了什么SDK? (dotnet --version)
  • 我正在运行一个 asp.net core 3.1 应用程序。安装的 SDK 是最新的 3.1.402。 Web 项目没有显示任何错误,但我的所有其他项目都是。
  • 你有本地单声道安装吗? - 如果是这样,these instructions 有帮助吗? VSCode 还有一个 OmniSharp 输出(输出窗口),可以有额外的日志。
  • @MartinUllrich 非常感谢!那效果很好。知道为什么会突然发生这种情况吗?

标签: c# .net-core visual-studio-code omnisharp


【解决方案1】:

感谢@Martin Ullrich 并向@Chris Kooken 提出一个好问题。我认为这应该是该页面的下一个访问者的认可答案。

按照这些steps 帮助我解决了这个问题:

 * Go to the VSCode settings (File > Preferences > Settings).
 * Search with the keywords omnisharp use global mono to locate the configuration.
 * Change the value to never from either auto or always.
 * REMEMBER to restart the VSCode to activate the change (I restarted it twice to be sure).

【讨论】:

    猜你喜欢
    • 2018-09-30
    • 2022-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-16
    • 2012-03-31
    • 1970-01-01
    • 2016-09-24
    相关资源
    最近更新 更多