3
votes

If you're creating a NuGet package where you have to add some third party dependencies, you basically have 2 options:

  1. Internalize the DLL's in your package's lib folder.
  2. Reference the third party libraries as a dependency in your nuspec file.

I noticed for example that RavenDB has internalized as good as all it's third party dependencies, while some other projects explicitly depend on other NuGet packages.

I'm wondering if there are any best practices/tips on when to pick either approach. What are the pros & cons of each?

2
MS is moving a lot of .net code to nuget packages with dependencies. I agree with maartenba's answerEonasdan

2 Answers

6
votes

In good spirit of NuGet, I would recommend adding the dependencies on third party packages instead of internalizing DLL's. NuGet has been built around "dependencies" and it makes total sense of relying on those.

0
votes

I would venture to say it depends more on if your implementation is version specific and if there is potential that when a dependency is updated and released could your package benefit from it (or possibly be damaged if an implementation is deprecated).

Also, by making the packages have nuget dependencies you reduce duplication and directory size (and your package size). The more common libraries are only included in your project once (yet any other package that may also use this library benefits as it's already been included).