Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace a file in a msi installer?

I want to replace a single file inside a msi. How to do it?

like image 679
luntain Avatar asked Sep 24 '08 11:09

luntain


People also ask

How do I replace a file?

Right-click the document file the content of which you want to replace. Press the Alt key and select Operations > Replace with File... from the menu bar. Locate and select the file that you want to use for replacing the original file content. Click OK.

Can I rename a MSI file?

There is no limit in renaming MSI files.

How do I install an msi file on Windows?

Double-click the file to run it. This will start the installation wizard, and start installing the program. If you're prompted, click Run in the confirmation pop-up. Follow the installation wizard's prompts. The installation wizard will guide you throughout the setup and install the program contained in this MSI file.

What happens to the original file when MSI is installed?

* The original file will not be removed from the MSI, but simply orphaned (no component refers to it). It will not be installed, but will remain in the package. * * \param OriginalFileName (this is the files target name at the clients computer after installation.

How do I repackage MSI?

The easiest way to do it is to repackage MSI: Open MSI file in Wise for Windows Installer. Choose an option to to extract files. Locate the file on disk and replace it. Build MSI.

How do I edit an msi file in MST?

Select the IT Pros tab and choose the MST project type - > New Transform template 3. Click on the [Create Project] button. 4. Choose the MSI file that you need to edit. 5. Once the MSI loads, start making the changes that you will need to be stored in the MST file. 6. Next, locate the file that you want to replace.


2 Answers

Use msi2xml.

  1. This command extracts the MSI files:

    msi2xml -c OutputDir TestMSI.MSI

  2. Open OutputDir and modify the file.

  3. To rebuild the MSI run:

    xml2msi.exe -m TestMSI.xml

You need the -m to ignore the 'MD5 checksum test' that fails when an MSIs file(s) are modified.

like image 82
Keith Harrison Avatar answered Sep 21 '22 19:09

Keith Harrison


You need to extract the CAB file stream from your msi using MsiDB.exe (supplied with the Windows Installer SDK). Run it from the command line with the -x option and specify the name of the cab file - this is listed in the Media table in the msi database.

Alternatively you can skip this part if you specify the "Package Files as:" option in the VSI options to "Compresses in Cabinet Files" to have the cab file left out of the msi when it's built (it will be created in the same directory as the msi).

Once extracted you can change the specified file in the cab folder - its name has been mangled so you need to find out what msi name for the file is in the file table and then rename your new file to that.

Once done you can pop it back in with the MsiDB utility using the -a option.

Before you add with -a you need to use msidb -k to remove the cab from the MSI.

like image 34
splattne Avatar answered Sep 19 '22 19:09

splattne