Package content guidelines and unused references

Topics: General
Jul 27, 2012 at 7:21 AM

Hi,

 

I used a package having dependencies, so package dependencies are added to my project.

Then, I remove unused references (with Resharper, but I could do it manually), and one of the removed reference comes from a package dependency.

So, when I run my application, I naturally got a "could not found assembly...[removed ref]".

Note that if I download the "old fashion" package, I add the reference manually to the dll D1 (that references D2 which is in the package bin dir also), and at compilation time, I got D1 and D2 in my output dir, so my application would start without problem.

My question is what is the recommanded way ? I hope it is not to keep unused references, since it would mean that Nuget manages transitive dependencies at dev time, but leads to produce a package removing all transitivity in dependencies, i.e having a direct dependency/reference on all transitively resolved dependencies...

Thanks for your feedback.

Clément

Jul 31, 2012 at 7:00 AM
Madfun wrote:

My question is what is the recommanded way ? I hope it is not to keep unused references, since it would mean that Nuget manages transitive dependencies at dev time, but leads to produce a package removing all transitivity in dependencies, i.e having a direct dependency/reference on all transitively resolved dependencies...

Sorry I don't quite follow this paragraph. Why is it a problem keeping unused references? The .NET compilers are smart enough to not include unused references into the metadata of the current project.