1

I am in the process of putting our library projects into a private NuGet feed and I've found that the libraries have a mess of dependencies upon each other. There will probably be some re-factoring down the road, but for right now I'm tasked with getting them into NuGet as-is, and I'm not sure what the best practice for dependencies is.

For example:

Library B needs Library A.
Library D needs Library C and B.
Library E needs Library D.

Now, if I use Manage NuGet Packages to pull down Library E, it'll obviously discover this whole dependency tree and pull down Libraries A through D.

The question is, in the .nuspec file for Library E, which dependencies should I list? Should I list only Library D and let NuGet walk that tree and figure it all out when someone grabs it? Or should it list Libraries A through D since they all show up in the packages.config and you'll end up pulling them all?

1 Answer 1

1

It will walk the dependency tree to find all the necessary packages. I've built some 3 deep.

I would think that it would be best to allow this to happen by design because you want those packages to be independent and not consume dlls directly as that would cause other conflicts and defeat the purpose of NuGet.

I've been using https://docs.nuget.org/ndocs/consume-packages/dependency-resolution#cousin-dependencies and https://docs.nuget.org/ndocs/create-packages/dependency-versions as references for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.