Using Msiexec.exe to Launch a Second Windows Installer Installation
InstallShield 2020
Project:This information applies to the following project types:
An alternative to launching a second .msi package using the nested installation custom action type is to create a custom action that launches Msiexec.exe instead. Launching a second installation in this manner causes it to run in its own process and creates the proper entries on the target system. In addition, the uninstallation process is much more effective when you launch your second installation in this way. Registry entries are properly cleaned up and reference counts are incremented and decremented accurately.
Creating a Custom Action
The first step is to create your custom action. The easiest way to do this is to use the Custom Action Wizard.
To create a custom action using the wizard:
|
1.
|
In the View List under Behavior and Logic, click Custom Actions and Sequences (in Basic MSI, InstallScript MSI, MSI Database, and Transform projects) or Custom Actions (in DIM, Merge Module, and MSM Database projects). |
|
2.
|
Right-click the Custom Actions explorer and click Custom Action Wizard. The Custom Action Wizard opens. |
|
3.
|
On the Basic Information panel, specify a name and comment for your custom action and click Next. |
|
4.
|
On the Action Type panel, in the Type list, select Launch an executable. In the Location list, select Stored in the Directory table. The Directory table allows you to choose from predefined folders, such as SystemFolder, which is where Msiexec.exe is located. |
|
5.
|
On the Action Parameters panel, browse for the executable file (Msiexec.exe) of that you are launching. The Target box enables you to specify the name of the executable file that you would like to launch, as well as any command-line parameters that you would like to pass to it. For example: |
msiexec.exe /i "[SOURCEDIR]AnotherSetup\SecondSetup.msi" /qb
The first part of this entry, msiexec.exe, is the name of the executable file that you would like to launch. The next section, /i "[SOURCEDIR]AnotherSetup\SecondSetup.msi", tells Msiexec.exe which package to run. In this case, it is pointing to a file one folder below that of the source folder of the initial installation. Finally, /qb tells the Windows Installer service to run the installation with minimal user interface. Only a progress bar is displayed.
|
6.
|
On the Additional Options panel, select the default options and click Next until you finish the wizard. |
Inserting a Custom Action into a Sequence
After you have created a custom action, you need to insert it into a sequence.
To sequence this custom action:
|
1.
|
In the View List under Behavior and Logic, click Custom Actions and Sequences (in Basic MSI, InstallScript MSI, MSI Database, and Transform projects) or Custom Actions (in Merge Module and MSM Database projects). |
|
2.
|
In the Sequences explorer, under the Installation sequence, expand the User Interface item. The actions and dialogs that are scheduled for this sequence are listed. |
|
4.
|
Select the new custom action. |
Next, verify that the installation package that you want to launch is located in the folder that you specified in the Action Parameters panel, build your installation, and run it.
Note:A custom action that launches Msiexec.exe must be placed in the User Interface sequence, which means that the custom action will not run if the end user runs the installation silently.
See Also
Nested Installations
MsiExec.exe Command-Line Parameters