简体   繁体   中英

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. However my packages.config gets all .netcore dependencies. How can I prevent that?

This is the 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. There are 3 folders in the lib folders of the package, so I would expect to only need these specific dependencies...

How can I avoid add all these dependencies?

UAParser is a pure .NET Standard based library.

.NET Standard versions lower than 2.0 depend on these libraries. 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).

These dlls put in place by tooling are needed to implement the .NET Standard contract on .NET Framework - they forward to .NET Framework implementations.

In the upcoming .NET 4.7.2, the plan is to no longer need any of these DLLs. Until then, they are necessary.

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