How to create a nested .msi package (306439)



The information in this article applies to:

  • Microsoft Windows Installer 1.1
  • Microsoft Windows Installer 1.2
  • Microsoft Windows Installer 2.0

This article was previously published under Q306439

SUMMARY

A nested installation action installs another Windows Installer package during a currently running installation. This article shows how to create a package that performs a nested installation.

MORE INFORMATION

You can add a nested installation to a package by authoring a nested installation action into the CustomAction table and scheduling this custom action into the sequence tables. The Target box of the CustomAction table contains a string of public property settings that are used by the nested installation. The Source box of the CustomAction table identifies the nested package. 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 box of the CustomAction table. Depending on the custom action type, the package for the nested application can reside in "substorage" of the main package, as a file at a location specified by a property, or as an advertised application on the user's computer.
Custom action typeDescription
Custom action type 7Nested installation of a product residing in the installation package.
Custom action type 23Nested installation of an installer package within the current source tree.
Custom action type 39Nested installation of an advertised installer package.
The following is an example of how to create a type 7 nested installation custom action. The example uses a tool called Orca (this tool is packaged with the Windows Installer SDK) to edit the .msi package because Visual Studio Installer cannot created nested installation custom actions. (For more information on Orca, see the "References" section). The nested installation involves two .msi packages. The following example uses Basic.msi as the parent .msi package and Nest.msi as the nested .msi package.
  1. Use the Msidb tool (this tool is packaged with the Windows Installer SDK) to add the Nest.msi package as a "substorage" of the Basic.msi file. The command line is:

    Msidb -d Basic.msi -r Nest.msi

    This will add Nest.msi to the Basic.msi file as substorage. No dialog box will appear to confirm that this was successful, but the file size for Basic.msi will increase.

    Note You cannot add Nest.msi as substorage by using the Binary table in Orca. When you add a file to an MSI through the Binary table, the file is added as a binary stream, not as substorage. Files added by the Binary table cannot be referenced by the source column of the CustomAction table.
  2. Use Orca to open Basic.msi. Locate the CustomAction table and type the information for the custom action. If you need to pass any public properties to the nested package, you can use the Target box for this. There will be two custom actions, one for install and one for uninstall (which has a target of "REMOVE=ALL"). The following is an example CustomAction table:
    ActionTypeSourceTarget
    InstallNest7Nest.msi
    UnInstallNest7Nest.msiREMOVE=ALL
  3. Schedule the custom action in the InstallExecuteSequence table. There are conditional statements for both the Install and Uninstall actions in the InstallExecuteSequence table. The condition will tie to a component for the Install (>2) and Uninstall (<=2). You could also tie these actions to a feature or another property. The nested installation custom action must be placed before InstallFinalize. If you use a component or a feature as a condition, the custom action must be placed after CostFinalize. The following is an example InstallExecuteSequence that assumes there is a component in Basic.msi named "Comp_1" and conditions the nested installation based on the state of Comp_1):
    ActionConditionSequence
    InstallNest$Comp_1>23110
    UnInstallNest$Comp_1<=23120
Although you can create a nested MSI installation, there are drawbacks to doing this. These drawbacks include the following:
  • 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.

REFERENCES

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

255905 How to use the Orca database editor to edit Windows Installer files


Modification Type:MajorLast Reviewed:7/23/2006
Keywords:kbhowto KB306439