How do I deploy an application and its prerequisites? (Mary Lee)
Let me count the ways: xcopy, ClickOnce, Windows Installer (.msi), Windows Installer XML, Group Policy, Active Directory, Systems Management Service or System Center Configuration Manager, login scripts, CD, USB drive, and many more third-party software options.
Despite the many options, one common requirement is that applications typically have prerequisites to install before the application can run. Prerequisites can include the .NET Framework, Visual Basic PowerPacks, SQL Server Express, Windows Installer, runtime libraries, or maybe even a custom prerequisite.
There are three concepts in deployment related to prerequisites.
- Chaining or bootstrapping.
Nesting is the process of embedding a Windows Installer file (.msi) within another .msi file. However, the How to create a nested .msi package article has an important disclaimer.
The drawbacks of creating a nested MSI installation are listed in the same article.
- Nested installations cannot share components.
- An administrative installation cannot contain a nested installation.
- Patching and upgrading will not work with nested installations.
- The installer will not correctly cost a nested installation.
- Integrated ProgressBars cannot be used with nested installations.
- Resources that are to be advertised cannot be installed by the nested installation.
- A package that performs a nested installation of an application should also uninstall the nested application when the parent product is uninstalled.
For these reasons, nesting is no longer supported.
Merging includes shared code, files, resources, registry entries, and setup logic to applications as a single compound file. Prerequisites available as a merge module (.msm) form can be added to a .msi file. For example, if a prerequisite is available as an .msm, you can add it to a Setup project in Visual Studio as shown in How to: Create or Add a Merge Module Project. However, merge modules cannot be serviced by the same owner as the .msi file, so it is difficult to fix issues in the merge module. Tao of the Windows Installer, Part 4 lists two cautionary notes:
- Do not consume merge modules of vendors who do not promise to fix their merge modules promptly when bugs arrive
- Be prepared to handle the heat when bugs are found in your merge module causing issues for others’ products that have consumed your merge module and you get to put out the flame
For these reasons, using merge modules is not recommended.
Chaining or bootstrapping is the process of checking for and installing missing prerequisites, including installing the application that is going to be used to install the rest of the prerequisites and application. You can use Visual Studio to generate a chainer/bootstrapper that is called Setup.exe. This program checks for and installs missing prerequisites before installing the application.
If you have created a Visual Basic Windows application by using Visual Studio, the default selections in the Prerequisites Dialog Box are Windows Installer and the .NET Framework. To learn more about how to install prerequisites in Visual Studio, see the following topics.
You can create custom prerequisites and add them to the Prerequisites Dialog Box in Visual Studio. Use the Bootstrapper Manifest Generator to create a product.xml file that describes the prerequisite and a package.xml files that includes locale-specific error messages. Then, copy the bootstrapper package to Program FilesMicrosoft SDKsWindowsv6.0ABootstrapperPackages folder. For more information, see Creating Bootstrapper Packages.
You may want to use other tools besides Visual Studio to generate a bootstrapper. For example, you can also use MSBuild and the GenerateBootstrapper Task to create a bootstrapper on a build computer. Alternatively, you can use the Windows Installer XML Toolset to generate .msi files and package prerequisites. For more information, see http://wix.sourceforge.net/.
Nesting and merging create a single file to deploy an application and its prerequisites, but these methods are not supported and not recommended. Chaining or bootstrapping is an effective way of checking for and installing prerequisites on end-user computers so that your applications run successfully. For more questions about chaining and bootstrapping, search for answers or post new questions in the ClickOnce and Setup & Deployment forum.
Mary Lee, Programming Writer.