How to create a Nested Installation with an .MSI embedded into the main .MSI and Uninstall with a Custom Action.
Errors can result when one .MSI is called during the ExecuteImmediate sequence of a second .MSI because the Windows Installer service normally only allows one .MSI installation to execute at a time. To work around this limitation, you can design a nested installation. Nested installations enable you to conveniently run a Windows Installer installation that is already advertised or installed on the destination machine from within your main .MSI installation.
Before you create this nested installation, you must have a main installation file and the nested installation file accessible from the destination machine. In this article, you first create two .MSI installations, Other.MSI and Main.MSI. Next, you create the custom action to set up the nested installation. Then you create a custom action for the uninstall. When the Main.MSI runs, it will call the Other.MSI file.
Note: You can use two .WSI files instead through this process with the nested file needing to be compiled prior to adding the Custom Action in the main .WSI project file.
To create two .MSI files for a nested installation:
To create a custom action for the nested installation:
To create a custom action for the uninstall:
To test your installation:
You now have a working nested installation and uninstall custom action in your installation. When you are running a nested installation, you cannot modify the directory where Other.MSI installs the application. When you browse for the directory, it only changes the location of Main.MSI.
Optionally, you can force the state of the main installation to track the state of the nested installation. To do this, modify the property settings in the installation following the steps below:
If you want to run a nested installation from a relative path, make sure the following conditions are true.