Sunday 22 June 2008

Tip on adding many content files to a .net setup project

We have had this problem at work for ages now where we have added 300-400 database scripts to our .net installer project. This included tables, stored procedures, functions, indexes, triggers, the lot. It was a constant pain in the arse adding the files to the correct output directory.

When all we really wanted was a "grab all the files in these directories and copy them in the exact same layout to the install directory when the installer runs" method.

This would be a nice function to have in the native .net installer but it isn't there.

When we move to a better installer maybe they will have a function like that but if your still stuck using the native .net installer projects then we came up with a bit of an easier way to do it, its not a perfect fix but its a bit quicker.

Add all the files to an empty project as content.





This will retain the directory structure of the files as they are on your disk.


Then add this project to your Merge Module or MSI installer project. In the correct directory of the Files view window just add the content files of your newly created empty project.





It has saved me a heck of a lot of time maintaining the directory structure in the installer project. Now I just maintain the file structure on the disk and in our source control.



Now to check out installawhere.