8

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

1
  • Resharper can be the problem too. You can try disabling it. Tools > Options > Resharper Commented Aug 22, 2016 at 8:50

2 Answers 2

4

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"
    }
  }
}
Sign up to request clarification or add additional context in comments.

3 Comments

Sorry I totally misunderstood the meaning of the -> in the link you shared. I edited your post and added another link which makes things more clear IMHO. But the edit was mostly to be able to remove my downvote, but I still can't... Sorry about that
@Josh Schultz, I'm having the same problem with the last version of .NET Core. I have changed "netstandard1.6" into "netstandard1.4" but it didn't help. Has the solution changed after they released .NET Core?
I'm having this same issue. NuGet no longer allows you to get .NetStandard 1.4. It only allows 1.6 through the front end, or "1.5.0-rc2-24027" if you edit it directly in the project.json
3

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.