windows 手动创建 MSI 补丁 (.msp)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2474604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:09:11  来源:igfitidea点击:

Creating a MSI patch (.msp) by hand?

windowswixinstallerwindows-installermsp

提问by Jerry Chong

Our team has recently been considering pushing out a minor registry fix to users to modify one particular problematic key. Pretty straightforward stuff, just needed to update 1 key/value inside the registry.

我们的团队最近一直在考虑向用户推出一个小的注册表修复程序,以修改一个特定的有问题的键。非常简单的东西,只需要更新注册表中的 1 个键/值。

So at the moment, we are using Wix to build .msi installers for the product. While looking into Wix's support for generating .msp patch files, it seems that the only way to create an .msp is a somewhat overcomplicated multi-step process to:

所以目前,我们正在使用 Wix 为产品构建 .msi 安装程序。在研究 Wix 对生成 .msp 补丁文件的支持时,似乎创建 .msp 的唯一方法是一个有点过于复杂的多步骤过程:

  1. Get a copy of the original MSI, and compile a new copy of the fixed MSI
  2. Write a new Wix file that points to both installers
  3. Compile the Wix file into a .wixobj with Candle to a .psp
  4. Run Torch/Pyro over before/after snapshots of the original installers and the .psp, or alternatively using MsiMsp.exe
  1. 获取原始 MSI 的副本,并编译固定 MSI 的新副本
  2. 编写一个指向两个安装程序的新 Wix 文件
  3. 使用 Candle 将 Wix 文件编译为 .wixobj 到 .psp
  4. 在原始安装程序和 .psp 的快照之前/之后运行 Torch/Pyro,或者使用 MsiMsp.exe

Now my question is, can't I simply describe the registry change into a Wix file and directly compile it into the .msp, without step 1 and 4 - which is a huge amount of effort for just a simple change?

现在我的问题是,我不能简单地将注册表更改描述为 Wix 文件并直接将其编译到 .msp 中,而无需执行第 1 步和第 4 步——这对于一个简单的更改来说是一项巨大的努力吗?

采纳答案by Ed.

No. A patch is the delta of two installable images. To generate the delta, even if the difference is very small, you will need both images.

不是。补丁是两个可安装映像的增量。要生成增量,即使差异很小,您也需要两个图像。

回答by 0xC0000022L

Yes, there is another way, even though you may consider it equally complicated:

是的,还有另一种方法,即使您可能认为它同样复杂:

  1. Create an admin install of your "base version" using msiexec /qn /a <msi-file> TARGETDIR=<absolute-path-of-existing-directory>(if you run this from a make file or other script, use start /waitin front of the command), say into %BASEDIR%
  2. repeat the above, but into %UPDDIR%
  3. Now that you have the installation unpacked inside %UPDDIR%, make your changes to the .msi file that will be in the root of that folder ... you should also preferably change the version number ...
    • If you exchange files, make sure to update the hash table (MsiFileHash) or the Filetable for files with version information.
    • If you change merely some registry value, you should be fine without any of that ...
  4. Now prepare a .pcp(Patch Creation Properties) file to point one row in the TargetImagestable to the .msiin %BASEDIR%and one row in UpgradedImagesto the .msiin %UPDIR%
  5. Invoke msimsp.exe <pcp-file> -p <absolute-path-to-desired-patch-file>
  1. 使用msiexec /qn /a <msi-file> TARGETDIR=<absolute-path-of-existing-directory>(如果您从 make 文件或其他脚本运行它start /wait,请在命令前面使用)创建“基本版本”的管理员安装,说进入%BASEDIR%
  2. 重复以上,但进入 %UPDDIR%
  3. 现在您已将安装解压缩到里面%UPDDIR%,对位于该文件夹根目录中的 .msi 文件进行更改……您还应该最好更改版本号……
    • 如果交换文件,请确保更新哈希表 ( MsiFileHash) 或File带有版本信息的文件表。
    • 如果您仅更改某些注册表值,那么没有任何更改应该没问题...
  4. 现在准备.pcp在(修补程序创建属性)文件指向一个行TargetImages表到.msi%BASEDIR%和一排UpgradedImages.msi%UPDIR%
  5. 调用 msimsp.exe <pcp-file> -p <absolute-path-to-desired-patch-file>

Voila, you're done.

瞧,你完成了。

Now whether this is worth it depends solely on you.

现在这是否值得完全取决于你。

It's how I am doing it with the help of some scripts that run SQL queries on the MSI databases in order to query values or update them as needed. This works perfectly well and has been put into a GNU make file to build a whole bunch of MSIs, derived MSIs, patches and dummy patches (for testing).

这就是我在一些脚本的帮助下在 MSI 数据库上运行 SQL 查询以查询值或根据需要更新它们的方式。这工作得很好,并已被放入 GNU make 文件以构建一大堆 MSI、派生 MSI、补丁和虚拟补丁(用于测试)。

The trick here is to patch the decompressed admin image and direct msimsp.exeto create a patch between the unchanged and the changed version of the decompressed admin image. All in all fits your requirement of doing it "by hand".

这里的技巧是修补解压缩的管理映像,并直接msimsp.exe在未更改的和已更改的解压管理映像版本之间创建补丁。总而言之,符合您“手工”操作的要求。

Write a comment in case something needs clarification.

写评论以防万一需要澄清。

回答by ewall

It is possible to create MSPs (patches) and MSTs (transforms) using Orca and the other tools from the Windows Install SDK (which is now part of the Windows SDK). However, the process may not be much easier than what you already have with WiX.

可以使用 Orca 和 Windows Install SDK(现在是Windows SDK 的一部分)中的其他工具创建 MSP(补丁)和 MST(转换)。但是,该过程可能并不比您已经使用 WiX 容易得多。

Hereis the best explanation I could find with a few minutes of Googling; I still suspect there must be something better out there, though. But if you're familiar with the Windows Installer format, it's pretty easy to explore and try a few things with Orca until you have the hang of it.

是我用几分钟的谷歌搜索找到的最好的解释;不过,我仍然怀疑那里一定有更好的东西。但是,如果您熟悉 Windows Installer 格式,那么在您掌握它的窍门之前,可以很容易地探索并尝试使用 Orca 进行一些操作。