JScoobyCed
JScoobyCed

Reputation: 10413

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: enter image description here

And this is what is added when fetch this package: enter image description here

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?

Upvotes: 0

Views: 99

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100543

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.

Upvotes: 2

Related Questions