Kubko Piško
Kubko Piško

Reputation: 21

Referencing .NetCore Class Library in .NetCore Web Application

I have created a .NetCore Class Library which I have tested in same solution with .NetCore Console Application (and it works just fine), however when I try referencing it inside another (ASP.NET Core Web Application) solution as a NuGet package I always get a error

NU1002 The dependency YoutubeExtractorCore 0.0.6 does not support framework .NETCoreApp,Version=v1.0.

I have added the netcoreapp1.0 in the class library project.json, which looks like this:

{
  "title": "YoutubeExtractorCore",
  "description": ".NET Core library used for extracting information about Youtube videos",
  "version": "0.0.6-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "Newtonsoft.Json": "9.0.1"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50",
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0"
        }
      }
    },
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

I spent this afternoon trying to fix the problem but I cannot even understand why this error occurs.

Upvotes: 0

Views: 275

Answers (1)

Kubko Piško
Kubko Piško

Reputation: 21

I finally figured out what was causing the problem. The NuGet package I created was packed with nuget.exe manually, and for some reason did not have the frameworks and their dependencies listed. I fixed the package by executing dotnet pack on the class library and this produced correcly packed NuGet package.

Upvotes: 1

Related Questions