引用类库

时间:2016-04-18 18:29:06

标签: asp.net asp.net-mvc asp.net-mvc-5

我正在尝试使用MVC5创建我的主要应用程序,以引用我的模型,业务层。引用时我收到以下错误

enter image description here

这是我的文件夹结构

enter image description here

这是我的project.json

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

我有Visual Studio Community 2015,并且不确定如何解决此问题。

这是我的主要项目的属性显示

enter image description here

1 个答案:

答案 0 :(得分:2)

在project.json文件中,更改:

"frameworks": {
  "dnx451": { },
  "dnxcore50": { }
},

对此:

"frameworks": {
  "dnx452": { }
},

您创建的类库不是portable class libraries,因此与DNXCORE50不兼容,后者是一个跨平台的框架。