I am wondering what to include when building my project. I have a library I need to reference for my project to build but that library has 10 dependencies itself. Should I reference those dependencies as well or should I copy them to the output directory using a post build event?
What is the best practice?
I find it confusing to include all those dependencies as the project compiles fine without them – are they then called runtime dependencies? My references become cluttered with dependencies irrelevent to my project even though they are used in some library I am including.
I am using Visual Studio.
Can someone please give me some insight into how to do this right.
Thanks.
You only need to add references that are directly used by your project.
For private assemblies (those not in the GAC) Visual Studio will, by default, copy referenced assemblies (and their dependencies) to your project’s output directory.
For assemblies in the GAC Visual Studio doesn’t copy the referenced assembly to your project’s output directory by default.
In both cases you can change the behavior by changing the ‘Copy Local’ reference property.
IMHO, it’s a nifty feature of the build environment. In the unmanaged world it’s up to you to keep track of your dependencies’ dependencies (usually through pre or post build events).