asp.net - 引用类库

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

我正在尝试制作我的主应用程序(这是一个使用 MVC5 的 Web api)来引用我的模型、业务层。引用时出现以下错误

enter image description here

这是我的文件夹结构

enter image description here

这是我的项目.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

最佳答案

在您的project.json 文件中,更改以下内容:

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

对此:

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

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

关于asp.net - 引用类库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36701660/

相关文章:

c# - [目录未找到异常 : Could not find a part of the path

asp.net - .Net MVC线程长时间运行的过程

c# - 如何确定数组中的值属于哪个范围?

asp.net-mvc - 是否可以在MVC网站上使用自定义错误页面,但不能在Web API上使用?

c# - 不以某些文字开头的 ASP.NET MVC 路由

c# - 自定义 DataAnnotationsModelMetadataProvider 不起作用

asp.net-mvc-5 - Mono MVC5 User.Identity.IsAuthenticated 在使用 FormsAuthentication.SetAuthCookie() 登录后返回 false

c# - 针对 Windows 文件的服务器端病毒扫描

c# - Google+ API plus.me

c# - ThreadAbortException 有什么特别之处?