Conversions

Table of Contents:

How to create an XML document from your MSI:

  1. Create an MSI file using a database editing tool such as Orca, which comes with the Windows Installer SDK, or a commercial product such Wise for Windows Installer or InstallShield.

    Make sure:

    1. There exists a Cabs table which lists all the Cabinet files saved inside the MSI. The Cabs table has the format:

      Cabs table
      Name(String[32] NOT NULL) Data(Binary)

    2. Every cabinet in the Cabs table has a corresponding entry in the Media table.  Given a row in the Cabs table with the Name column equal to "cabinetname", there must exist a row in the Media table with its Cabinet column equal to "#Cabs.cabinetname".



      Cabs table
      Name(String[32] NOT NULL) Data(Binary)
      cabinetname {binary data}


    3. Media table
      DiskId LastSequence DiskPrompt Cabinet VolumeLabel Source
      ... ... ... #Cabs.cabinetname

  2. Use  msi2xml with the -b option to create the XML version of the MSI package, with the binary streams saved to external files.  Make sure you set the folder where the binary streams are saved equal to "." (the current folder).  For example, if myinstaller.msi is saved in C:\installers\ then do:

    C:\>cd installers
    C:\installers>msi2xml -b . myinstaller

  3. Create a document called "mkfile_short.txt" listing all your cabinets and the files included in each cabinet, making sure the files are listed under the cabinets in the same order they are saved in.  For example:

    Sample mkfile_short.txt:

    m1.cab =
        file1.txt
        file2.exe

    m2.cab =
        file3.txt
        file4.exe

    Here's a Perl script that does this for you if you have msidb.exe in your path (msidb.exe comes with Platform SDK Components for Windows Installer Developers).

  4. If the MSI is repackaged from a setup executable, then also provide a document detailing where all the files can be found on a machine with the software installed.  All paths (except system paths such as C:\WINNT\) should be relative paths.  This file is especially valuable if multiple files with the same name are installed on the destination machine in different folders.  For example:

    Sample mkfile_long.txt:

    m1.cab =
    .\docs\file1.txt
    .\bin\file2.exe

    m2.cab =
    .\docsfile3.txt
    C:\WINNT\system32\file4.exe

    If you used Wise for Windows Installer to generate the MSI, then the script from step 3 above can also be used to generate this file.

  5. Create a new SourceForge project for your installer and check the XML into your new project's CVS repository.  Check in also any binary streams that are part of your installation, such as custom actions, but not part of the software you're installing.

  6. Insert commented lines in your mkfile_*.txt to indicate where binaries streams that are not part of the software you're installing can be found. Use # at the beginning of every comment line.

  7. Email msi-repackaging-admin@lists.sourceforge.net with the name of your SourceForge project and we'll add your project to our list.  Be sure to provide the following info:

How to create an XML document from your MSM:

  1. Run msi2xml as in step 2 of "How to create an XML document from your MSI" above.
  2. Binaries in merge modules are normally saved in MergeModule.CABinet.  msi2xml does not currently extract that, so you must manually do it.

    C:\>cd installers
    C:\installers>msidb -d myinstaller.msm -x MergeModule.CABinet

  3. Create a mkfile_* as discussed in steps 3 and 4 of "How to create an XML document from your MSI" above. The same script can be used if given a special flag.
  4. Do step 6 of "How to create an XML document from your MSI" above.
  5. Check it into CVS on SourceForge and drop us a line.

How to recreate an MSI from an XML document:

  1. Obtain a copy of mkfile_short.txt and/or mkfile_long.txt for the package you want to build, plus binary streams that are part of the installer (should be listed in mkfile_*.txt).
  2. Install the application locally.
  3. Create all the cabinet files using the local binaries and the mkfile_*.txt.  If all the files listed in mkfile_*.txt are present on the your local machine in the same places as indicated by mkfile_*.txt, then you can use this Perl script to generate the cabinets for you.  The script relies on cabarc.exe, which should be in your path, to create the cabinets.
  4. Place all the binary files as well as the cabinets in the same directory as the XML file and run:

    C:\>cd installers
    C:\installers>xml2msi myinstaller.xml

How to recreate an MSM from an XML document:

  1. Do all the steps outlined in "How to recreate an MSI from an XML document" above.
  2. You must manually add MergeModule.CABinet into the MSM by doing:

    C:\>cd installers
    C:\installers>msidb -d myinstaller.msm -a MergeModule.CABinet