简体   繁体   English

向ASP.NET Core应用程序添加依赖项

[英]Add dependency to an ASP.NET Core application

I'm trying to use the forecast API with my ASP.NET CORE app. 我正在尝试将预测API与我的ASP.NET CORE应用程序一起使用。 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/ . 我是linux用户,所以我下载了块模块并使用Mono运行它。我从https://www.nuget.org/packages/Forecast.io/下载了c#wrapper。 Then under project.json i added the dependency 然后在project.json下添加了依赖项

project.json 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. 但是我得到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). 由于您的目标是Mono,因此您不必使用.NET Core( netcoreapp1.0是.NET Core应用程序目标名字对象)。

ASP.NET Core doesn't mean it only runs on .NET Core. ASP.NET Core并不意味着它只能在.NET Core上运行。 ASP.NET also runs against the Full .NET Framework (4.5.1 or higher or mono). ASP.NET还针对完整.NET Framework(4.5.1或更高版本或单声道)运行。

All you need to do is remove the netcoreapp1.0 moniker and replace it with net451 . 您需要做的就是删除netcoreapp1.0名字对象并将其替换为net451 Also don't forget to remove the Microsoft.NETCore.App package, if it's still there. 另外,不要忘记删除Microsoft.NETCore.App包,如果它仍然存在。

Your frameworks section in project.json should look something like this: project.json中的frameworks部分看起来像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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