Jseb
Jseb

Reputation: 1934

Referencing to Class Library

I am trying to make my main app, which is a web api using MVC5, to reference to my Model, Business Layers. When referencing I get the following error

enter image description here

This is my folder structure

enter image description here

This is my 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"
  ]
}

I have Visual Studio Community 2015, and not sure how to fix this.

This is what my properties for my main project show

enter image description here

Upvotes: 2

Views: 68

Answers (1)

Will Ray
Will Ray

Reputation: 10879

In your project.json file, change this:

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

To this:

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

The class libraries that you've created are not portable class libraries, and as such are not compatible with DNXCORE50, which is a cross-platform framework.

Upvotes: 2

Related Questions