【问题标题】:The type 'X' is defined in an assembly that is not referenced. VS2015/aspnetcore/c#类型“X”在未引用的程序集中定义。 VS2015/aspnetcore/c#
【发布时间】:2016-10-01 23:36:23
【问题描述】:

我正在使用 rc2 aspnetcore,如果我使用命令 dotnet run,我的项目构建和运行良好,但在 Visual Studio 中我收到 700 多个错误提示

类型“X”是在未引用的程序集中定义的。你必须 添加对程序集 'System.Runtime, 版本 4.0.0.0 的引用, 文化=纯...'

这是为什么?我是否必须将 System.Runtime 的引用添加到我的 project.json 文件中,以便 VS2015 在构建时不会抛出这些异常?

我正在使用 dotnet cli 版本 1.0.0-preview2-002913 来运行我的代码。

【问题讨论】:

  • 你的目标是什么框架?
  • @Marcus 我的目标是 net451

标签: c# asp.net .net visual-studio-2015 asp.net-core


【解决方案1】:

将 System.Runtime 添加到“frameworkAssemblies”到您的project.json

"frameworks": {
    "net451": {
        "frameworkAssemblies": {
            "System.Runtime": "4.0.10.0"
        }
    },

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-07
    • 1970-01-01
    • 2011-08-16
    • 2014-08-15
    • 2016-05-01
    相关资源
    最近更新 更多