Muokkaa

Jaa


Using Automation to Merge a Merge Module into a Database

Merge Modules provide a standard method for you to deliver shared Windows Installer components, and setup logic to applications.

Merge modules must be merged into an installation package by using a merge tool. The best practice is to obtain a freely distributed merge tool, or purchase one of the merge tools that are available from independent software vendors, for example, you can use Mergemod.dll.

The following procedure shows you how to merge a merge module into a Windows Installer database by using Merge Module Automation.

To merge a module into a database

  1. Open a log file by using the OpenLog method.

    This step is required only if you need to create a log file, or append an existing log file for the merge process.

  2. Open the .msi installation database by using the OpenDatabase method of the Merge Object.

    This step is required.

    The database that you open is the one that you want to receive the merge module.

  3. Open the .msm merge module by using the OpenModule method.

    This step is required.

    This is the merge module that is being merged into the database. A module must be opened before it can be merged with an installation database.

  4. Merge the module into the installation database by calling the Merge method or MergeEx method.

    This step is required.

    The Merge method or MergeEx method can only be called one time to merge a specific combination of .msi and .msm files.

    Note

    The MergeEx method is only available in Mergemod.dll version 2.0 or later, and only when using the IMsmMerge2 interface.

     

  5. Retrieve the Errors property and examine the collection of Error objects it returns for merge conflicts or other errors.

    You must resolve any errors.

    The retrieval is nondestructive, and multiple instances of the error collection can be retrieved by repeatedly reading the Errors property.

  6. Associate the components of the merge module with the features by using the Connect method.

    This step is only required if you have existing features and you want to add features to merge into the installation database.

    A feature must exist before you call this method. For more information, see Connecting a Merge Module to Multiple Features.

  7. If necessary, extract source files from the module by doing one or more of the following:

  8. Close the current open merge module by using the CloseModule method.

    This step is required.

  9. Close the open installation database by using the CloseDatabase method.

    This step is required.

    Closing a database clears all dependency information, but does not affect any errors that are not retrieved.

  10. Close the current log file by using the CloseLog method.

    This step is required if you have an open log file.

After the module has been merged into the database using Mergemod.dll, the Media Table must be updated to describe the desired source image layout. The merge process provided by Mergemod.dll does not update the Media Table because the consumer of the merge module can select various ways to layout the source image.

Released Versions, Tools, and Redistributables