简体   繁体   English

Nuget软件包管理器为另一个目标安装依赖项

[英]Nuget package manager installs dependencies for another target

So I have a DLL which is targeting multiple versions (.net 4.5, 4.6.1, netcore 2.0) which is pushed to a Klonkdike Now I want to use this DLL, my project is .net 4.6.1, so I expect to resolve dependencies on this target only. 因此,我有一个针对多个版本(.net 4.5、4.6.1,netcore 2.0)的DLL,该DLL已推送到Klonkdike。现在,我想使用此DLL,我的项目是.net 4.6.1,因此我希望解决仅依赖于此目标。 However my packages.config gets all .netcore dependencies. 但是我的packages.config获取所有.netcore依赖项。 How can I prevent that? 我该如何预防?

This is the DLL: 这是DLL: 在此处输入图片说明

And this is what is added when fetch this package: 这是在获取此程序包时添加的内容: 在此处输入图片说明

I would expect to have only UAParser to be added and no other change since I already have the dependencies. 我希望只添加UAParser,而没有其他更改,因为我已经有了依赖项。 There are 3 folders in the lib folders of the package, so I would expect to only need these specific dependencies... 软件包的lib文件夹中有3个文件夹,因此我希望只需要这些特定的依赖项...

How can I avoid add all these dependencies? 如何避免添加所有这些依赖项?

UAParser is a pure .NET Standard based library. UAParser是一个基于.NET Standard的纯库。

.NET Standard versions lower than 2.0 depend on these libraries. 低于2.0的.NET Standard版本取决于这些库。 However, the new tooling in VS 2017 (make sure you have at least 15.5.0) trims out these packages during build and makes sure the right assemblies are in place (these may also be System.* dll files but are not coming from these packages). 但是,VS 2017中的新工具(请确保您至少具有15.5.0)在构建过程中会修剪掉这些程序包,并确保正确的程序集就位(这些也可能是System。* dll文件,但并非来自这些文件。包)。

These dlls put in place by tooling are needed to implement the .NET Standard contract on .NET Framework - they forward to .NET Framework implementations. 在工具上放置的这些dll是在.NET Framework上实施.NET Standard合同所必需的-它们转发到.NET Framework实现。

In the upcoming .NET 4.7.2, the plan is to no longer need any of these DLLs. 在即将发布的.NET 4.7.2中,计划是不再需要任何这些DLL。 Until then, they are necessary. 在此之前,它们是必需的。

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

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