【问题标题】:How to specify file location for ComponentGroupRef in WiX如何在 WiX 中为 ComponentGroupRef 指定文件位置
【发布时间】:2015-12-16 05:02:39
【问题描述】:

我是 WiX 的新手。我使用 Heat 工具根据文件夹生成 wxs 文件。现在如何在 product.wxs 中使用 wxs 文件而不实际将生成的文件包含到解决方案中。仅供参考,我知道我可以使用“ComponentGroupRef Id”引用生成的文件,但是如何指定 ComponentGroupRef 的文件路径?

【问题讨论】:

    标签: wix wix3.10


    【解决方案1】:

    检查 before build 目标中的收获元素。

    <Target Name="BeforeBuild">
      <HarvestDirectory Include="$(SourceDir)">
        <DirectoryRefId>INSTALLDIR</DirectoryRefId>
        <ComponentGroupName>cmpMain</ComponentGroupName>
        <PreprocessorVariable>var.SourceDir</PreprocessorVariable>
        <SuppressUniqueIds>false</SuppressUniqueIds>
        <SuppressCom>true</SuppressCom>
        <SuppressRegistry>true</SuppressRegistry>
        <SuppressRootDirectory>true</SuppressRootDirectory>
        <KeepEmptyDirectories>false</KeepEmptyDirectories>
      <Transforms>DefaultTransform.xsl</Transforms>
    </HarvestDirectory>
    

    制作组件组并引用生成的文件:

    <ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
      <ComponentGroupRef Id="cmpMain" />
    </ComponentGroup>
    

    *您可以跳过此步骤并直接移至功能表中的引用,但我更喜欢在不同的 Components.wxs 文件中定义所有组件。

    然后将组件组包含在特征表中:

    <Feature Id="Main" Title="Main" Level="1" ConfigurableDirectory="INSTALLDIR" >
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
    

    【讨论】:

      【解决方案2】:

      您不必指定该组件组所在文件的路径。你基本上应该做两件事:

      • 确保您的热生成文件包含在编译过程中。您可以将其放在其他 wxs 文件旁边,然后让蜡烛选择该文件夹
      • 正如您所提到的,在 ComponentGroupRef 元素的帮助下,从您的 product.wxs 引用该组件组

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-05
        • 1970-01-01
        • 2012-09-05
        • 2011-02-21
        • 1970-01-01
        • 1970-01-01
        • 2011-06-18
        • 2017-01-11
        相关资源
        最近更新 更多