I’m using Visual Studio 2008 and would like to create a sort of container project that holds a number of DLL’s that must be installed with a solution. I want them to be in a separate project so that they can be easily attached to a solution as a group.
I created an empty project call TEST, added my DLL’s to it with a Build Action of “Content”, and set them to “Copy Always”. That all works exactly as I want. The problem is that if I set the TEST project Output Type to “Console Application” or “Windows Application” that it won’t build because there’s no entry point. If I set the Output Type to “Class Library”, it builds but I end up with an extra TEST.DLL file that I don’t really want.
Is there anyway to sort of set the Output Type to “none”? I want the build actions to take place (so my DLL’s get copied) but I don’t want the dummy class assembly created. Any ideas?
Thanks!
Assumptions for the following step-by-step guide:
Let’s assume that you have a solution with two projects:
Main: your main (start-up) project.BundledDLLs: a library project which contains the.dlls that should end up in the main project’s output directory.Step-by-step guide:
The easiest way to achieve your goal inside Visual Studio is probably the following:
Add all
.dlls toBundledDLLsand set their Copy to output directory to Copy if newer.This is done in the Project Explorer and the Properties windows.
Configure
BundledDLLs‘s output directory to be identical toMain‘s output directory.This can be done in the Build tab of
BundledDLL‘s Project Properties page. Enter something like the following in the Output Path textbox:Set up
BundledDLLsas a dependency ofMain.Do not add
BundledDLLsas a project reference toMain, as you usually might; instead, use the Project Dependencies dialog to . This will tell the build tool that wheneverMainis built,BundledDLLsneeds to be built first.Do this by right-clicking on the
Mainproject node to open the context menu; select Project dependencies… from there. In the now opened dialog, first selectMainfrom the drop-down list; then checkBundledDLLsin the project list below.BundledDLLsis now registered as a dependency ofMain.Add a post-build event to
BundledDLLsthat deletes the superfluousBundledDLLs.dll.As you said, you don’t want, and don’t need, the dummy output generated when
BundledDLLsis built. So add a post-build event that simply deletes this.dllonce it’s been created.Open the Build events tab in
BundledDLLs‘s Project Properties page, and enter something like the following in the post-build textbox:(In case you wondered: The reason why you didn’t add this project as a project reference to
Mainearlier is because if you had done so,Mainwould be looking forBundledDLLs.dll, which it wouldn’t be able to find since you don’t actually want such a file to be generated.)