MST file to automate MSI file editing

Default Setup project in visual studio does not give all the options we need. As a result, many people employ third party setup projects. Another option is using ORCA tool from Microsoft to edit the MSI file for your requirement. In the later approach, you first need to build the MSI file (Windows Installer package) using visual studio, then open the MSI file in ORCA and make the necessary changes. Basically MSI file contains a database (a number of tables) that you can edit using ORCA; Editing operations include adding new rows and editing existing rows to different tables.

However, there is a problem in the process of using ORCA. The problem is that each time you make changes in the project and build a new installer; you have to make the same changes in ORCA. To address this issue, Microsoft offers MST file (kind of a batch file) to automate the process. To make an MST file, you can follow the following steps:

1. Open an MSI file in ORCA

2. use Transform -> New Transform menu to start editing

3. modify what you need

4. use Transform -> Generate Transform menu to save the transform to a MST file

Once you have the MST file, you will apply the MST file to MSI file to update MSI file each time you update the MSI file. However, there is a catch, specially if you have embedded binary streams (such as embedded cabinet files)

1. Open the newly created MSI file by file->open

2. Then click Transform->Apply Transform and select the previously created MST file

3. If you have embedded binary streams, go to Tools/Options, on the “Database” tab there is an option called “Copy embedded streams during ‘Save As’.” and enable it.

4. Finally save the MSI using "Save Transformed as" under file menu.

Alternatively, you can apply MST file from command line or using a batch file:

cscript WiUseXfm.vbs [path to original database][path to transform file][options]

For details, look at MSDN

The Orca editor is available in the Windows Installer SDK. Hope this will save some of your time!

No Comments