I am planning to replace a DLL file within the MSI file. Is there any way to do it without effecting the MSI installation
3 Answers
InstEdit (http://www.instedit.com/) does work, but it is not an intuitive tool. You do not have to have the plus version, the basic works for this. Just completed using it. Here's the process.
Take old MSI and install it to get all the original targets of install.
copy all install targets to working directory with your current MSI.
open InstEdit and open the MSI (or just drag/drop MSI into InstEdit interface)
Open the Tables tab (see image)
Click the Media item and you'll see some info on the right
Right-click in the right-side window and choose Rebuild Selected CABs.
Once you've completed a successful rebuild, you need to go to File...Save As... and save the MSI file so that your changes are incorporated into the new MSI file. NOTE: Save As... is the best option here because I noticed that if you do a regular Save... then it seems to make the final MSI larger -- as if it keeps old components and adds the new ones. The Save As... option creates a smaller MSI.
If you replace the old item in the directory where all of the items for the MSI are found, then when you click Rebuild Selected CABs it will import the newer version of the item automatically and rebuild your CAB.
Errors are cryptic, but if you read them closely you can figure it out and it does work. I replaced a EXE in the MSI with a newly built version.
EDIT
It's been almost 1 year and I came back to remind myself how the InstEd tool works. However, I also stumbled upon an error that you may encounter also so I want to add the additional information.
When you attempt to [Rebuild Selected CABs] you may get an error which looks like the following:
This is somewhat of a cryptic error. InstEd is attempting to tell you that you need the CommonFilesFolder created at the location you are attempting to rebuild the CABs from. Then place the Main.exe in that folder. It is also looking for Main.ico in that same folder.
All you need to do is copy the target .exe and .ico (or any files mentioned) into the CommonFilesFolder and run the rebuild again and it will work.

- 8,142
- 7
- 66
- 87
-
Because the InstEd interface is so non-intuitive I wrote the above answer up weeks ago and forgot about it. Today I had to edit another MSI (we own the licensed version now) and I came back here to remember how to use the software. ;) – raddevus Jul 26 '16 at 15:03
-
For some reason this doesn't work for me. I get another error - "MakeCab failed". – PASAf Sep 05 '17 at 01:27
-
@PASAf I know this is late, but your problem may be for another reason and that reason may be because you need the original files that are to be included in the MSI in a location that is pointed to by the InstEd project so that when it rebuilds it pulls all those files in. It's quite tricky. – raddevus Dec 18 '18 at 21:41
-
The InstEd interface is so confusing that I had to come back and remind myself how to re-build the MSI again. It's so confusing that you have to go to that Media item on the side and then right click the item on the right and then you can rebuild it. Why not a menu option that says Rebuild MSI? Not sure. But is a weird UX. – raddevus Dec 18 '18 at 21:43
-
1Just wanted to add on that you need to save the .msi in order for your changes to show up. I thought there was an output file I was missing after making the updated .cab haha. Also thanks for the edit! – user2619824 May 13 '19 at 20:46
First off, you might want to check out other alternatives than modifying the MSI directly. This is rarely a good way to go but you may have your reasons. For other options, check out MSDN on patches.
But if you are going to modify it directly, check out this blog entry. It explains how to use Orca, InstEdit, MSIdb, and IExpress to extract the CAB, decompress the CAB, replace the file, recompress and attach the CAB file back into the MSI.

- 170
- 1
- 6
Try InstEdit from http://apps.instedit.com/, but i`m not sure if it is possible to replace file inside msi package. Also you can take a look at Microsoft Orca msi editor that comes with Windows SDK.

- 839
- 1
- 7
- 19