如何使用绑定路径创建WiX补丁? [英] How can I use bindpaths to create a WiX Patch?

查看:145
本文介绍了如何使用绑定路径创建WiX补丁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cmake / cpack和WiX来构建我的项目。

I'm using cmake/cpack to build my project with WiX.

cmake运行heat.exe(或类似方法),该文件会生成包含以下内容的files.wxs:我项目的文件格式如下:

cmake runs heat.exe (or something similar) which produces files.wxs that contains the files of my project in the following format:

我们假设在名为 bin的文件夹中有一个名为a.txt的文件。该项目在桌​​面上的NewFolder中构建。

We'll assume a single file named a.txt inside a folder named "bin". The project is built in NewFolder on the Desktop.

<DirectoryRef Id="CM_DP_bin">
    <Component Id="CM_CP_bin.a.txt" Guid="*">
        <File Id="CM_FP_bin.a.txt" Source="C:/Users/mindlessbot/Desktop/NewFolder/_CPack_Packages/WIX/packageName/bin/a.txt" KeyPath="yes"/>
    </Component>
</DirectoryRef>

在创建MSI之后,整个NewFolder将移动到另一个目录中(在我们的服务器上)。结果,当我尝试使用输出.wixpdb创建WiX补丁时,出现以下错误:

After the MSI is created, the whole NewFolder is moved in a different directory (on our server). As a result, when I try to create a WiX Patch using the output .wixpdb, I get the following error:

error PYRO0103 : The system cannot find the file 'C:/Users/mindlessbot/Desktop/NewFolder/_CPack_Packages/WIX/packageName/bin/a.txt'

经过一番谷歌搜索后,我发现.wixpdb包含对文件的引用,这些文件的位置已更改,因此当然找不到它们。我找到了一个线程,有人提供了使用绑定路径的命令,但是由于我使用的是cpack,因此无法直接调用它们。

After some googling, I found out that the .wixpdb contains references to the files, which have changed location, so of course it can't find them. I found a thread where someone provided the commands to use bindpaths, however since I'm using cpack I can't directly call them.

那么我应该怎么做呢?

一些其他信息:

我的项目包含多个wxs文件(不确定是否有区别)

My project contains multiple wxs files (not sure if it makes any difference)

cpack命令为:

path/to/cpack.exe -G WIX --config path/to/config.cmake

patch命令是单独运行的:

The patch command is run separately:

torch.exe -p -xi path/to/oldInstaller.wixpdb path/to/newInstaller.wixpdb -out path/to/patch.wixmst
candle.exe path/to/patch.wxs -out path/to/patch.wixobj
light.exe path/to/patch.wixobj -out path/to/patch/wixmsp
pyro.exe path/to/patch.wixmsp -out path/to/patch.msp -t PatchBaselineID path/to/patch/wixmst


推荐答案

会李ke在一台计算机上构建MSI,但在另一台计算机上构建补丁,我建议使用 .wixout 方法,而不要依赖 .wixpdb 方法。 .wixout 文件可能由用于构建MSI的同一WiX Toolset CLI工具生成,即 light.exe .wixout

In the event that you would like to build your MSIs on one machine, but build the patch on another, I recommend using the .wixout approach rather than relying on the .wixpdb approach. A .wixout file may be generated by the same WiX Toolset CLI tool that is used to build the MSIs, light.exe. The .wixout

WiX Toolset链接器上的完整文档 light.exe ,可以在此处找到。以下是使用 light.exe 生成 .wixout 文件的示例:

Full documentation on the WiX Toolset linker, light.exe, may be found here. The following is an example use of light.exe to build a .wixout file:

C:\Program Files(x86)\WiX Toolset v3.11\bin\light.exe /path/to/Some.wixobj /path/to/Another.wixobj /path/to/AndYetAnother.wixlib -bf -xo -out /path/to/MyInstaller_v1.wixout

现在让我们细分这些命令行参数的用途:

So now let's breakdown what these command line parameters are for:


  • / path / to / Some.wixobj /path/to/Another.wixobj /path/to/AndYetAnother.wixlib -这些是WiX源文件的编译输出,它们可能是 .wixobj 文件(通过 candle.exe 生成)或 .wixlib 文件(通过 lit.exe 生成,这是一种将 .wixobj 文件合并到一个可共享的库中的方式)。

  • -bf -此开关导致所有文件被绑定到结果 .wixout 文件。这样一来,在构建补丁程序时就无需在目标计算机上具有确切的文件夹结构,因为这些文件是通过 .wixout 文件携带的。

  • -xo -此开关告诉链接器输出MSI的XML表示形式,而不是实际的MSI。必须使用 -bf 开关。

  • -out / path / to / MyInstaller_v1。 wixout -告诉链接器在哪里输出 .wixout 文件。

  • "/path/to/Some.wixobj" "/path/to/Another.wixobj" "/path/to/AndYetAnother.wixlib" - These are the compiled outputs of WiX source files, they may be either .wixobj files (generated through candle.exe) or .wixlib files (generated through lit.exe, a way of consolidating .wixobj files into one, shareable library).
  • -bf - This switch causes all of the files to be bound int the resulting .wixout file. This is what removes the need to have the exact folder structure on the target machine when building patches, because the files are carried with the .wixout file.
  • -xo - This switch tells the linker to output an XML representation of the MSI, instead of the actual MSI. This is required to use the -bf switch.
  • -out "/path/to/MyInstaller_v1.wixout" - This tells the linker where to output the .wixout file.

一旦您能够生成 .wixout 文件,则可以使用 torch.exe 命令可以修改为基于 .wixout 文件而不是 .wixpdb 文件及其关联的文件夹结构运行。以下是我如何修改您的 torch.exe 命令以使用 .wixout 文件而不是 .wixpdb 文件:

Once you have the capability of generating .wixout files, the torch.exe command can be modified to run based on .wixout files instead of .wixpdb files and their associated folder structures. The following is how I would modify your torch.exe command to use .wixout files as opposed to .wixpdb files:

torch.exe -p -xi路径/到/oldInstaller.wixout path / to / newInstaller.wixout -out path / to / patch.wixmst

所以,总的来说,我真的很喜欢这种方法,通常我会在构建过程中生成 .msi .wixout 文件。这使我们可以将安装程序的各种内部版本/版本缓存为 .wixout 文件,然后在的各个版本之间创建补丁。 wixout 文件变得相对容易。

So, all in all I really like this approach, and generally I make my build process produce both an .msi and a .wixout file. This allows us to cache various builds/versions of our installer as .wixout files, and then the process of creating a patch between various versions of the .wixout files becomes relatively easy.

这篇关于如何使用绑定路径创建WiX补丁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆