简体   繁体   English

什么是nuget包中的net core和net standard之间的依赖关系

[英]What is dependencies between net core and net standard in nuget packages

I try to add AutoMapper for test .net core application with 2 target frameworks: 我尝试通过2个目标框架为测试.net核心应用程序添加AutoMapper:

  • .net core 1.1 .net核心1.1
  • .net framework 461 .net框架461

Also My app references on ClassLibrary1 project that target net standard 1.6 我的应用程序还引用了以网络标准1.6为目标的ClassLibrary1项目

And I have doubts adding nuget package AutoMapper.Extensions.Microsoft.DependencyInjection. 我怀疑是否要添加nuget包AutoMapper.Extensions.Microsoft.DependencyInjection。

在此处输入图片说明

  1. If I select the newest version of nuget package, I see in its dependencies .Net Standart 2.0, does It mean I'm able to add this package only to project, that targets .net core 2.0 or net standard 2.0? 如果我选择最新版本的nuget软件包,我会在其依赖项中看到.Net Standart 2.0,这是否意味着我只能将此软件包添加到针对.net core 2.0或net standard 2.0的项目中?

  2. If I select older version 2.0.0 (as on screen above) It will have 3 dependecies platform. 如果我选择旧版本2.0.0(如上面的屏幕所示),它将具有3个相互依赖的平台。 Does It mean I'm able to add this package to WebApplication2 (as it references net core 1.1 and net fw 461) and moreover I'm able to add this package to my ClassLibrary? 这是否意味着我可以将此程序包添加到WebApplication2(因为它引用了net core 1.1和net fw 461),而且还可以将此程序包添加到ClassLibrary?

If I select the newest version of nuget package, I see in its dependencies .Net Standart 2.0, does It mean I'm able to add this package only to project, that targets .net core 2.0 or net standard 2.0? 如果我选择最新版本的nuget软件包,我会在其依赖项中看到.Net Standart 2.0,这是否意味着我只能将此软件包添加到针对.net core 2.0或net standard 2.0的项目中?

You are correct. 你是对的。 As this table shows, .NET Standard 2.0 could only be referenced by .NET Core 2.0 and higher, .NET Framework 4.6.1 and higher or .NET Standard 2.0 and higher. 如下表所示,.NET Standard 2.0只能由.NET Core 2.0和更高版本,.NET Framework 4.6.1和更高版本或.NET Standard 2.0和更高版本引用。

If I select older version 2.0.0 (as on screen above) It will have 3 dependecies platform. 如果我选择旧版本2.0.0(如上面的屏幕所示),它将具有3个相互依赖的平台。 Does It mean I'm able to add this package to WebApplication2 (as it references net core 1.1 and net fw 461) and moreover I'm able to add this package to my ClassLibrary? 这是否意味着我可以将此程序包添加到WebApplication2(因为它引用了net core 1.1和net fw 461),而且还可以将此程序包添加到ClassLibrary?

You can add this package to an application that targets .NET Framework 4.5.1 and higher, or to any .NET Core application since .NET Core supports all versions of .NET Standard. 您可以将此包添加到面向.NET Framework 4.5.1及更高版本的应用程序中,也可以添加到任何.NET Core应用程序中,因为.NET Core支持所有版本的.NET Standard。 Or you can add the package to a class library that targets .NET Standard 1.1 and higher. 或者,您可以将包添加到针对.NET Standard 1.1及更高版本的类库。 Moreover, if your class library targets .NET Standard 1.1-1.5, the package will have just 2 dependencies, otherwise (1.6-2.0) it will have three. 此外,如果您的类库针对.NET Standard 1.1-1.5,则该程序包将仅具有2个依赖关系,否则(1.6-2.0)它将具有3个依赖关系。

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

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