开发者

Replace a file from MSI

开发者 https://www.devze.com 2023-01-29 10:29 出处:网络
I am planning to replace a DLL file within the MSI file. Is there 开发者_如何学编程any way to do it without effecting the MSI installation First off, you might want to check out other alternatives tha

I am planning to replace a DLL file within the MSI file. Is there 开发者_如何学编程any way to do it without effecting the MSI installation


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.


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.
1. Take old MSI and install it to get all the original targets of install.

  1. copy all install targets to working directory with your current MSI.

  2. open InstEdit and open the MSI (or just drag/drop MSI into InstEdit interface)

  3. Open the Tables tab (see image)

  4. Click the Media item and you'll see some info on the right

  5. Right-click in the right-side window and choose Rebuild Selected CABs.

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.

Replace a file from MSI

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:

Replace a file from MSI

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消