简体   繁体   中英

Add dependency to an ASP.NET Core application

I'm trying to use the forecast API with my ASP.NET CORE app. I'm a linux user so I downloaded the nugget CLI and run it with Mono.I downloaded the c# wrapper from here https://www.nuget.org/packages/Forecast.io/ . Then under project.json i added the dependency

project.json

"Forecast.io":"1.0.10"

However i get error NU1002: The dependency Forecast.io 1.0.10 does not support framework .NETCoreApp,Version=v1.0.

How do have to link the package in my project so I can use the dependency?

Since you target Mono, you don't have to use .NET Core ( netcoreapp1.0 is the .NET Core application target moniker).

ASP.NET Core doesn't mean it only runs on .NET Core. ASP.NET also runs against the Full .NET Framework (4.5.1 or higher or mono).

All you need to do is remove the netcoreapp1.0 moniker and replace it with net451 . Also don't forget to remove the Microsoft.NETCore.App package, if it's still there.

Your frameworks section in project.json should look something like this:

  "frameworks": {
    "net452": { }
  },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM