For this post I would like to provide an overview of the Visual Studio 2005 Generic Bootstrapper. Not as the generic deployment engine for custom packages, but rather that it truly is.
Bootstrapper GoalsOn the very high level the generic Bootstrapper is a program called setup.exe. It is built by MSBuild taking in a list of custom packages defined in XML files. This setup.exe program will then detect if the custom package is installed and download and install it if necessary.
How we Accomplish itThe magic of setup.exe is that it isn't compiled as part of the build process. In fact it isn't compiled at all. The Bootstrapper or setup.exe is compiled with Visual Studio and included in the .NET FX SDK as a binary file.When you publish a ClickOnce application what MSBuild does is take setup.bin (an 'empty' setup.exe) and embeds the installation script into the file's resources. Essentially we stuff all the information the Bootstrapper needs to know into itself! This way, when you run setup.exe the first thing it does it check its internal resources for the installation script rather than relying on a loose file.Binary-WitchcraftMaking the Bootstrapper 'self aware' like this does more than eliminate the need for loose files, it also makes it easier to develop localized applications. All of the Bootstrapper's UI strings are embedded at build time as well. So you can create a pig-latin localized setup.exe by simply replacing an XML file.More than just installation scripts and UI strings are embedded into the Bootstrapper. External checks and EULAs are embedded as well.So if you have ever wondered why the file size of setup.exe can fluctuate between 400k and 2MB, now you know. This technique allows you to distribute just setup.exe and avoid the mess of keeping other required files nearby. Untill next time, deploy on!