WiX 3.0合并模块:Source属性的含义

发布于 2024-09-02 10:52:43 字数 362 浏览 2 评论 0原文

Source 属性的用途是什么?看一下这个片段:

<Component Id="MyComponent" Guid="123456789-abcd-defa-1234-DCEA-01234567890A">
          <File Id="myFile" Name="myFile.dll" Source="myFile.dll"/>
</Component>

既然 Name 和 Source 具有相同的值,那么 Source 添加了什么?如果没有它,代码将无法编译。

在哪里可以找到解释这些属性的文档?我已经尝试过 MSDN 的 MSI 但没有找到答案。

谢谢。

What is the purpose of the Source attribute? Have a look at this snippet:

<Component Id="MyComponent" Guid="123456789-abcd-defa-1234-DCEA-01234567890A">
          <File Id="myFile" Name="myFile.dll" Source="myFile.dll"/>
</Component>

Since Name and Source have the same value, what does Source add? The code does not compile without it.

Where can I find documentation that explains these attributes? I have tried MSDN for MSI but did not find an answer.

Thanks.

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

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

发布评论

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

评论(2

青春如此纠结 2024-09-09 10:52:43

WiX 和 MSI 不一样。因此,MSDN 文档中没有任何参考;)

您需要参考安装 WiX 的 WiX.CHM,或者 在线 WiX 文档

假设您正在谈论 File/@NameFile/@Source,如果您的源文件的布局方式与 WiX 目录结构相同,则这是可选的。

当您在 File/@Source 中对 lightSourceDir 使用多个 -b 参数时,漂亮的部分就出现了属性。例如...

<File Id="example.dll" KeyPath="yes" Source="SourceDir\example.dll" DefaultLanguage="0" />

我通常在标准构建中使用 -b 指定 4 个文件夹。一种用于各种安装程序特定的资源,一种用于存储合并模块的位置,一种用于所有安装之间的公共资源,一种用于我的源文件。现在,WiX 将查找命令行上指定的每个目录,如果我在具有不同目录布局的不同系统上进行构建,这会使事情变得更加可移植。

根据文档,如果(在您的示例中)myfile. dll 位于当前目录中,您可以省略 File/@Source 属性。

WiX and MSI are not the same. Hence no reference in the MSDN documentation ;)

You need to refer to WiX.CHM where you installed WiX, or the online WiX documentation.

Assuming you're talking about File/@Name and File/@Source, this is optional if your source files are laid out in the same way as your WiX directory structure.

The nifty part comes in when you use multiple -b arguments to light and SourceDir in the File/@Source attribute. For example...

<File Id="example.dll" KeyPath="yes" Source="SourceDir\example.dll" DefaultLanguage="0" />

I usually specify 4 folders with -b in my standard build. One for various installer specfiic resources, one for where I store merge modules, one for common resources between all my installs and one for my source files. Now WiX will look in every directory specified on the command line, which makes things a lot more portable if I'm building on a different system with a different directory layout.

As per the documentation, if (in your example) myfile.dll was in the current directory, you could omit the File/@Source attribute.

最单纯的乌龟 2024-09-09 10:52:43

File/@Source 提供获取有关文件的信息(大小、语言、哈希)并将其复制到正确位置(在文件柜中或放置在与 MSI 文件相关的目录中)的位置。

如果您不想使用不同名称安装文件,则 File/@Name 是可选的。换句话说,如果您的构建计算机上存在具有正确名称的文件,则只需使用 File/@Source 引用它并省略 File/@Name。

只要您的文件名是唯一的,File/@Id 也是可选的。您不能拥有两个具有相同 File/@Id 的文件,因此在发生冲突时请添加 File/@Id。

在 WiX v3.5 中我经常这样做:

;
<文件源=“my.exe”/>

File/@Source provides the location to get information about the file (size, language, hash) and to copy it to the correct location (either in a cabinet or laid out in a directory relative to the MSI file).

File/@Name is optional if you do not want to install the file with a different name. In other words, if the file exists with the right name on your build machine, just refer to it using the File/@Source and leave off File/@Name.

File/@Id is also optional as long your file name is unique. You cannot have two files with the same File/@Id so add File/@Id when you have collisions.

In WiX v3.5 I often just do:

<Component>
<File Source="my.exe"/>
</Component>

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