developer9969
developer9969

Reputation: 5236

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

Upvotes: 8

Views: 4636

Answers (2)

Josh Schultz
Josh Schultz

Reputation: 1077

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"
    }
  }
}

Upvotes: 4

Michael Giger
Michael Giger

Reputation: 125

I ran into the same Problem. I had to manually run "Restore Packages" and the error was gone!

Upvotes: 3

Related Questions