【问题标题】:The type or namespace name 'System' could not be found on Visual Studio Code for Mac在 Visual Studio Code for Mac 上找不到类型或命名空间名称“系统”
【发布时间】:2020-10-20 08:46:49
【问题描述】:

在通过 VSCode Omnisharp 的源代码控制区域意外删除项目后完全停止工作。任何以前的项目和任何新创建的项目都没有任何作用。在 Visual Studio 上一切正常,所以我认为问题不在于 .NET Core 安装。我在 Mac 上。

    "message": "The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) [API, API, API]"

我尝试过的:

  • 重新安装 .Net Core 3.1(无需先卸载)
  • 彻底删除 VSCode(包括隐藏目录、缓存等一切)
  • 在网络上找到了更简单的解决方案,例如重建、重新启动 omnisharp 等。

感谢任何帮助,谢谢!

【问题讨论】:

  • Core 库是一个单独的库,而在 Net 中每个库都有自己的命名空间 (dll)。如果您进入 VS : Solution Explorer 并查看引用的库,它们应该始终与模块顶部的 using 语句相同。您将在参考 System.Core 中看到的核心项目和 using 语句应该相同。
  • @jdweng 我不确定这是否有帮助,因为该项目在 Visual Studio 上运行良好,但在 Visual Studio Code 上却没有
  • @jdweng 如果是程序集问题,为什么它可以在 Visual Studio 上运行? :(
  • 这些库在 Net(你称之为 VS)和 Core 中的打包方式不同。这些库是 dll,您在核心应用程序中使用的 dll 与网络应用程序不同。

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


【解决方案1】:

按照这些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).

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-07
    • 2017-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多