Monday, October 17, 2011

Nested MSI's Installation and Uninstallation

What is Nested installation?
  • A nested installation action installs another Windows Installer package during a currently running installation.
  • A nested installation action can only reinstall or remove an application that has been installed by the current application's installation package.
  • The type of nested installation action is specified in the Type field of the CustomAction table. Depending upon the custom action type, the package for the nested application can reside in a substorage of the main package, as a file at a location specified by a property, or as an advertised application on the user's machine.The following types of custom actions perform a nested installation.
Custom Action Type 7
          Nested installation of a product residing in the installation package.
Custom Action Type 23
          Nested installation of an installer package within the current source tree.
Custom Action Type 39
          Nested installation of an advertised installer package.
  •  A nested installation shares the same user interface and logging settings as the main installation.
  • Nested installation actions should be placed between the InstallInitialize action and InstallFinalize action of the main installation's action sequence.
  • Standard or custom actions that specify an automatic restart of the system, or request the user to restart, can also perform restart or request from within a nested installation.
  •  A nested installation action can install an application to be run locally, to run from source, to be reinstalled, or to be removed .To specify this type of installation, pass either the ADDLOCAL, ADDSOURCE, REINSTALL, or REMOVE property to the nested installation action.
  •  Nested installation actions can be authored in pairs, one action used for installing and the other action used for removing the nested installation. A Custom Action Type 7 or Custom Action Type 23 is typically used to install. A Custom Action Type 39 is typically used to remove the nested installation when the parent product is uninstalled. The record for the removal custom action in the CustomAction table can have the product code GUID in the Source field and "REMOVE=ALL" in the Target field.
  • A child product generally does not appear in the user's Add/Remove Programs panel, and is not automatically uninstalled when the parent product is uninstalled.
Creating a Nested Installation

  Step 1: To create two MSI files for a nested installation:

  1. Open Wise Package Studio, open the Windows Installer Editor tool.
  2. Select New from the File menu. The New Installation File dialog appears.
  3. Select the Windows Application icon, then click OK.
  4. On the Files page in each .WSI, add at least one file to the installation.
  5. Save your file with the name Parent.WSI. Compile Parent.WSI into Parent .MSI.
  6. Follow steps 2 through 5 to create another .MSI file and name the next .WSI Child.WSI and compile it into an Child.MSI.
  7. Save this installation file with the name Child.MSI.

Step 2: To create a custom action for the nested installation:
  1. Open the Parent.MSI installation.
  2. Click the MSI Script tab, then click the Execute Immediate tab.
  3. Scroll down to the Cost Finalize script line in the Installation Sequence pane.
  4. Select the blank line below the Cost Finalize action then double-click the Install MSI from Installation or  Install MSI from Relative path action in the Actions pane. The required dialog appears dialog appears.
  5.  Fill in the fields as follows:
Custom Action Name: Enter a name for this custom action.
Installation to Run: Enter the path to the Child.MSI file.
Leave the Property Settings field blank.
Click OK.

6. Double-click the If Statement action in the Actions pane. The If Settings dialog appears.
7. Enter Not Installed in the If Condition field, then click OK.
8. Select the blank script line below the new custom action.
9. Double-click the End Statement action in the Actions pane.

To install all the features of the child installation with their default settings, and to use the same value for the ALLUSERS property used by the parent installation, type the following into the Target field:
One can use similar expressions to use the same value of INSTALLDIR in the child as in the parent.

Step 3: To create a custom action for the uninstall:
  1. Scroll down to the REM. Begin the sequence of actions that makes changes to the system script line, which is seven lines below the End statement you added to the script.
  2.  Select this script line then double-click the Install MSI from Destination action in the Actions pane. The Install MSI from Destination dialog appears.
  3.  Fill in the fields as follows:
Custom Action: Enter the name of the custom action.
Product Code: Copy and paste the Child.MSI product code.
Property Settings: Enter REMOVE~=ALL
Click OK.

4. Double-click the If Statement action in the Actions pane. The If Settings dialog appears.
5. Enter REMOVE~="ALL" in the If Condition field, then click OK.
6. In the Installation Sequence pane, select the line below the Install MSI from Destination Product Code that One created.
7. Double-click the End Statement action in the Actions pane.
8. Save and compile the Parent.MSI installation.

Media Options for Nested Installations:
• The child installation must not be compressed inside a Setup.exe installation launcher.
• If the child installation's files are not compressed inside the child .msi database, we must manually copy the child installation's files to the SourceDir folder of the parent installation.
Disadvantages of Nested MSIs:
  • 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.


me said...

Why would you bother showing someone how to use such a ridiculous method of installation.

not to mention it is deprecated in windows installer 5.0

Mayur Makwana said...

Hi,i agree with you.informative posting.there are numerous method available and also windows installer 5.0 is point here was to give basic idea of nested MSI and its installation and uninstallation process.