在Wix中,可以同时定义ComponentGroup和Directory吗?
我是 WiX 的新手。很新。有没有办法同时定义 ComponentGroup 和 Directory?
我有大量文件,总共大约 300 个左右,需要将它们分成多个组,每个组大约有 50 个文件。
使用 heat.exe,我能够创建一个为每个文件创建组件的片段。我希望避免在单独的 ComponentGroup 定义中重新列出这些组件中的每一个。我希望能够将热生成的组件列表包装在 ComponentGroup 定义中,然后只需在 DirectoryRef 结构中使用该 ComponentGroupRef 即可。
我希望这能解决问题。我目前必须做的:
<DirectoryRef Id="FilesDir">
<Component Id="a.txt" Guid="YOUR-GUID">
<File Id="a.txt" KeyPath="yes" Source="SourceDir\a.txt" />
</Component>
<Component Id="b.txt" Guid="YOUR-GUID">
<File Id="b.txt" KeyPath="yes" Source="SourceDir\b.txt" />
</Component>
...
<Component Id="z.txt" Guid="YOUR-GUID">
<File Id="z.txt" KeyPath="yes" Source="SourceDir\z.txt" />
</Component>
</DirectoryRef>
<ComponentGroup Id="FilesGroup">
<ComponentRef Id="a.txt">
<ComponentRef Id="b.txt">
...
<ComponentRef Id="z.txt">
</ComponentGroup>
我必须将每个文件列出两次。太臭了。
我希望能够做到:
<ComponentGroup Id="FilesGroup">
<Component Id="a.txt" Guid="YOUR-GUID">
<File Id="a.txt" KeyPath="yes" Source="SourceDir\a.txt" />
</Component>
<Component Id="b.txt" Guid="YOUR-GUID">
<File Id="b.txt" KeyPath="yes" Source="SourceDir\b.txt" />
</Component>
...
<Component Id="z.txt" Guid="YOUR-GUID">
<File Id="z.txt" KeyPath="yes" Source="SourceDir\z.txt" />
</Component>
</ComponentGroup>
<DirectoryRef Id="FilesDir">
<ComponentGroupRef Id="FilesGroup">
</DirectoryRef>
这可能吗?还有其他我没有看到的方法可以让这件事变得更容易吗?
更新:我们放弃了 Wix,因此我不确定是否应该标记解决方案。如果有人认为下面的答案之一是我现在相当老的问题的答案,请告诉我,我将标记适当的答案。
I'm new to WiX. Very new. Is there a way to define both a ComponentGroup and a Directory at the same time?
I have a large number of files, on the order of 300 or so total, that need to be split into a number of groups, with each group having somewhere around 50 files.
Using heat.exe, I was able to create a Fragment that creates Components for each file. I would like to avoid having to re-list each and every one of these components in a separate ComponentGroup definition. I would love to be able to wrap the list of components generated by heat in a ComponentGroup definition, then simply use that ComponentGroupRef inside of a DirectoryRef structure.
I hope this clears it up. I currently must do:
<DirectoryRef Id="FilesDir">
<Component Id="a.txt" Guid="YOUR-GUID">
<File Id="a.txt" KeyPath="yes" Source="SourceDir\a.txt" />
</Component>
<Component Id="b.txt" Guid="YOUR-GUID">
<File Id="b.txt" KeyPath="yes" Source="SourceDir\b.txt" />
</Component>
...
<Component Id="z.txt" Guid="YOUR-GUID">
<File Id="z.txt" KeyPath="yes" Source="SourceDir\z.txt" />
</Component>
</DirectoryRef>
<ComponentGroup Id="FilesGroup">
<ComponentRef Id="a.txt">
<ComponentRef Id="b.txt">
...
<ComponentRef Id="z.txt">
</ComponentGroup>
I have to list every file twice. That stinks.
I'd like to be able to do:
<ComponentGroup Id="FilesGroup">
<Component Id="a.txt" Guid="YOUR-GUID">
<File Id="a.txt" KeyPath="yes" Source="SourceDir\a.txt" />
</Component>
<Component Id="b.txt" Guid="YOUR-GUID">
<File Id="b.txt" KeyPath="yes" Source="SourceDir\b.txt" />
</Component>
...
<Component Id="z.txt" Guid="YOUR-GUID">
<File Id="z.txt" KeyPath="yes" Source="SourceDir\z.txt" />
</Component>
</ComponentGroup>
<DirectoryRef Id="FilesDir">
<ComponentGroupRef Id="FilesGroup">
</DirectoryRef>
Is that possible? Is there some other way of making this easier that I'm just not seeing?
Update: We abandoned Wix, and therefore I'm not sure if I should mark a solution or not. If someone feels one of the answers below IS the answer to my now-rather-old question, please let me know, and I'll mark the appropriate answer as such.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我希望我正确理解你的问题。我在每个构建上使用 heat 工具来自动生成包含针对构建输出目录内容的组件的 wxs。 WXS(简化后)看起来像这样:
在 Product.wxs 中,我有一个指向自动生成代码的硬编码链接:
在 wixproj 文件中定义了一个“收获任务”(它不是绝对干净的,但它可以工作)。 wixproj 并不完整,我删除了所有不相关的部分:
最重要的是执行收获的 Exec 元素。我使用“-dr Dir01”来定义组件将引用“Dir01”作为父目录,并使用“-cg ComGroup01”来定义组件组。
I hope I understand your question correct. I am using heat tool on every build to autogenerate wxs containing components targetting contents of my build output directory. The WXS (after simplification) looks like this:
in the Product.wxs I have this hardcode link to autogenerated code:
In wixproj file there is a "harvest-task" defined (it is not absolutely clean, but it works). The wixproj is not complete, I deleted all irrelevant parts:
Most important is the Exec element which executes the harvesting. I use "-dr Dir01" to define that components will reference "Dir01" as parent directory and "-cg ComGroup01" to define the componentGroup.
使用 -h 标志或选项描述。
这将为您提供一个
ComponentGroup ID
,您可以将其插入到您想要的功能中。Use the -h flag or description of the options.
This will give you a single
ComponentGroup ID
which you can plug into your desired feature.直接回答这个问题:是的,可以。
但是,最好让热量为你做这件苦差事。
To give a straight answer to the question: Yes you can.
But, it is better to let heat do this chore for you.