替换 MSI 中的文件

发布于 2024-10-06 23:46:42 字数 52 浏览 6 评论 0 原文

我计划替换 MSI 文件中的 DLL 文件。有没有办法在不影响MSI安装的情况下做到这一点

I am planning to replace a DLL file within the MSI file. Is there any way to do it without effecting the MSI installation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你好,陌生人 2024-10-13 23:46:42

首先,您可能想要查看除直接修改 MSI 之外的其他替代方案。这很少是一个好方法,但你可能有你的理由。有关其他选项,请查看 MSDN在补丁上

但如果您要直接修改它,请查看此 博客条目。它解释了如何使用 Orca、InstEdit、MSIdb 和 IExpress 提取 CAB、解压缩 CAB、替换文件、重新压缩 CAB 文件并将其附加回 MSI。

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.

<逆流佳人身旁 2024-10-13 23:46:42

InstEdit (http://www.instedit.com/) 确实有效,但它不是一个直观的工具。您不必拥有增强版,基本版就可以做到这一点。
刚刚使用完毕。这是过程。

  1. 获取旧的 MSI 并安装它以获得所有原始安装目标。

  2. 使用当前 MSI 将所有安装目标复制到工作目录。

  3. 打开 InstEdit 并打开 MSI(或者直接将 MSI 拖放到 InstEdit 界面中)

  4. 打开“表”选项卡(参见图片)

  5. 单击“媒体”项目,您将在右侧看到一些信息

  6. 右键单击右侧窗口并选择“重建选定的 CAB”。

  7. 成功完成重建后,您需要转到“文件...另存为...”并保存 MSI 文件,以便将您的更改合并到新的 MSI 文件中。注意:“另存为...”是这里最好的选择,因为我注意到,如果您定期进行“保存...”,那么它似乎会使最终的 MSI 更大 - 就好像它保留旧组件并添加新组件一样。 “另存为...”选项会创建较小的 MSI。

如果您替换找到 MSI 所有项目的目录中的旧项目,则当您单击“重建选定的 CAB”时,它将自动导入该项目的较新版本并重建您的 CAB。

错误是神秘的,但如果你仔细阅读它们,你就能弄清楚它并且它确实有效。我用新构建的版本替换了 MSI 中的 EXE。

InstEdit Media重建

编辑

已经快一年了,我回来提醒自己 InstEd 工具是如何工作的。但是,我还偶然发现了您也可能遇到的错误,因此我想添加附加信息。

当您尝试[重建选定的 CAB] 时,您可能会收到如下所示的错误:

addfolders

这是一个有点神秘的错误。 InstEd 试图告诉您,您需要在尝试重建 CAB 的位置创建 CommonFilesFolder。然后将 Main.exe 放入该文件夹中。它还在同一文件夹中查找 Main.ico。

您所需要做的就是将目标 .exe 和 .ico(或任何提到的文件)复制到 CommonFilesFolder 中,然后再次运行重建,它将起作用。

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.

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

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

  4. Open the Tables tab (see image)

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

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

  7. 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.

InstEdit Media Rebuild

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:

add folders

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.

伊面 2024-10-13 23:46:42

尝试 http://apps.instedit.com/ 中的 InstEdit,但我不确定是否可行替换 msi 包内的文件。您还可以查看 Windows SDK 附带的 Microsoft Orca msi 编辑器。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文