Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot add reference to .net core Class library asp.net core rc2

I am a newbie in the asp.net net core world and I am struggling to adding a simple ref . I get an error

Steps

1) Created an "Asp.net Core Web Application(Net Framework) RC2"

2) Added a Class Library (.Net core) called "ClassLibrary1")

3)Within the web app.Project.json i added a reference to the classlibrary1 like this

"dependencies": { "ClassLibrary1": "1.0.0-*", etc...

4) Get error

Severity Code Description Project File Line Suppression State Error

NU1001 The dependency ClassLibrary1 could not be resolved.

I understand why microsoft is doing this as they want to be lean and modular,however there should be an option that would add the reference for you like in the classic library.It's a step back in my view.

Is this a bug or its me?

thanks for any reply

like image 337
developer9969 Avatar asked May 18 '16 20:05

developer9969


1 Answers

Change your project.json in your class library to .netstandard1.4 (or lower).

Your web application is stating .NET Framework 4.6.1, but netstandard 1.5 can only target 4.6.2+ (related to .NET Framework that is).

https://github.com/dotnet/standard/blob/master/docs/versions.md

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.4": {
      "imports": "dnxcore50"
    }
  }
}
like image 118
Josh Schultz Avatar answered Oct 08 '22 00:10

Josh Schultz