Prerequisites
Possible solutions for implementing nested installations or nested executables in a Setup Project created in Visual Studio - without making use of installer tools (like InstallShield) - are listed below :
- Bootstrapping
- Custom Actions in a Setup Project (Install action > executable output)
- Custom Actions in a Setup Project (Install action > Installer class > override Install > Process.Start())
In this post, I will explain the Bootstrapping solution, which is generally the most prefered one. So what is 'bootstrapping' exactly?
"Bootstrapping is the process of installing prerequisite components"
Other common descriptions for Bootstrapping are : Prerequisites and Redistributable package.
A list of Prerequisites, which are installed on your workstation, can easily be obtained in Visual Studio by opening the Properties window of your Setup Project, then press button Prerequisites.... This list of Prerequisites, which is generated by Visual Studio, is based on the content of this specific folder:
\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
Each subfolder in this Pa
ckages folder represents a Prerequisite (Redistributable package) and contains the following files:
- product.xml manifest file
- package.xml manifest file
- the redistributable files (Optional. If not present, the software will be downloaded over the internet.)
As you will notice, there are some Prerequisites which are standard included with Visual Studio, such as Crystal Reports
Basic and SQL Server 2005 Express Edition. If an essential Prerequisite is not in the list, you will have to generate the Redistributable package manually. This is where the free downloadable Bootstrapper Manifest Generator tool will come in hand.
Bootstrapper Manifest Generator
As explained, a redistributable package consists of the XML Manifest files (product.xml, package.xml) and the Redistributable package (e.g. the executable file for installing Adobe Reader).
The Bootstrapper Manifest Generator (BMG) will enable you to quickly and easily configure and build the essential Prerequisite with corresponding Redistributable package. After you have build the Prerequisite, the contents of the Prerequisite will be copied to the Packages folder (mentioned before), after which Visual Studio will recognize this newly added Prerequisite.
There is some minor bug in this tool when re-opening a saved BMG file (extension .VSBootstrapperManifest), therefore the BMG tool will always be used for building new prerequisite packages, not for modifying existing BMG files. There are only a few required configuration settings, so that this minor limitation of the BMG should not cause a problem.
The following steps have to be accomplished in the BMG, in order to generate a Prerequisite :
1. Download and install the BMG
- Download : http://code.msdn.microsoft.com/bmg
- Open the downloaded file "BMG2008Setup.msi" to install the BMG
2. Starting the BMG tool
- The BMG executable file location is C:\Program Files\Microsoft\Bootstrapper Manifest Generator for VS2008\BMG.exe
In the following instructions, the example for generating the Prerequisite for Adobe Reader 9.0 will be used, for which the file
C:\Program Files\Adobe\Reader 9.0\ReadMe.htm will be applied to recognize if Adobe Reader 9.0. has already been installed. The executable file AdbeRdr920_en_US.exe, which has been downloaded from the Adobe website, represents the setup file for Adobe Reader 9.0.
3. Start the BMG tool (BMG.exe)
4. File > New > Package Manifest
5. Enter the Project Name, for example 'Adobe Reader 9.0'
6. Click in the textbox for Product Code to automatically enter a value in it ('Adobe.Reader.9.0')
7. In the white column area on the left side, right-click Package > Add Install File
- Press button Browse..., select the executable file which will install the Adobe Reader software ('AdbeRdr920_en_US.exe')
- Press button OK
8. Field Display Name - the value for this will be shown as the Prerequisite name in Visual Studio, enter the value 'Adobe Reader 9.0 en-US'
9. Tab page System Checks
- Click the icon File Check
- Property for Result: - enter an obvious value here, for example 'EXISTACROBATFILE'
- File name to search for: - enter the name of a file which will be installed, for this example, enter the value 'ReadMe.htm'
- Start Search in Special Folder: - check this if the mentioned file is located in the Program Files, in this example, ReadMe.htm is in the Program Files folder, so check this option
- The value in the dropdownlistbox : keep this unchanged ('ProgramFilesFolder')
- Path: - a relative path to the mentioned file, IF option Start Search in Special Folder: is checked (in this example, the value will be 'Adobe\Reader 9.0'), else an absolute path
10. Tab page Install Conditions
- Type : 'ByPassIf'
- Propery : 'EXISTACROBATFILE'
- Comparison : 'Exists'
11. Tab page Exit Codes
- Use Default System Exit Codes - keep this checked
- Result: select value 'Success'
- Format Message From System - uncheck
12. In the white column area on the left side, on top, click the icon Build
- Dialog window Build Results will be opened
- The last line in the log field should read:
'Build Succeeded. Warnings: 0, Errors: 0'
- Click the hyperlink on top of the window, next to 'Build Output'
- In Windows Explorer, the folder containing the prerequisite package (product.xml etc. etc.) will be openend
- Copy this folder (folder Adobe Reader 9.0 !!) to the Packages folder
\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
- The Prerequisite should now be in folder:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Adobe Reader 9.0
This concludes the generation of the Adobe Reader 9.0 Prerequisite. In Visual Studio, in the Prerequisites window (Properties dialog-window of a Setup Project > button Prerequisites...), the newly added Prerequisite Adobe Reader 9.0 en-US should now be an item in the list. Build your Setup Project, and the generated setup.exe file is the bootstrapper.
.Net Framework 3.5 SP1 Redistributable Package
Although the .Net Framework 3.5 SP1 Prerequisite is included with Visual Studio 2008, this Prerequisite does not include the Redistributable package. It is set up to downloadeded the 200Mb content of the package, thus a connection with the internet is required during the setup, which is not always desirable.
In order to make the Redistributable package for the .Net Framework 3.5 SP1 Prerequisite - to bypass the download during setup - several steps have to be accomplished, which are described in this document (paragraph 2.3.1.1).
Reference links
Bootstrapper Manifest Generator
Adding Custom Prerequisites
Product and Package Schema Reference
Visual Studio 2008 Service Pack 1 (SP1) Readme
Regards,
Wesly
e61319b7-7e07-4d3a-a579-262c8beeaf34|1|5.0