【问题标题】:How to heat empty directory in WiX?如何在 WiX 中加热空目录?
【发布时间】:2017-03-24 03:54:17
【问题描述】:

这是 cakebuild 脚本:

  WiXHeat(Directory("../Release"), new FilePath("./xxx/Files.wxs"), WiXHarvestType.Dir, new HeatSettings
  {
    AutogeneratedGuid = true,
    ComponentGroupName = "Binaries",
    Transform = "./Filter.xslt",
    SuppressCom = true,
    SuppressFragments = true,
    SuppressRegistry = true,
    SuppressRootDirectory = true,
    PreprocessorVariable = "var.xxx.TargetDir",
    DirectoryReferenceId = "INSTALLFOLDER",
    WorkingDirectory = "./xxx_Installer",
    KeepEmptyDirectories = true,
    GenerateGuid = true,
  });

它使用参数:-ke -ag -gg。

Files.wxs 看起来像:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="INSTALLFOLDER">
            <Directory Id="dir76A8B56EDC1C4DD3CB4177F3704BC91E" Name="data">
                <Component Id="cmpE375532277DA492834892BE47B02E5DA" Guid="*" KeyPath="yes">
                    <CreateFolder />
                </Component>
            </Directory>
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="Binaries">
            <ComponentRef Id="cmpE375532277DA492834892BE47B02E5DA" />
        </ComponentGroup>
    </Fragment>
</Wix>

然后 Light 不适用于 Files.wxs,这是错误:

...\Files.wxs(29):错误 LGHT0230:Component/@Guid 属性的 值“*”对此组件无效,因为它不符合 具有自动生成的 guid 的标准。组件 使用 Directory 作为 KeyPath 或包含 ODBCDataSource 子 元素不能使用自动生成的 guid。确保您的 组件没有 KeyPath 的 Directory 并移动任何 ODBCDataSource 子元素到具有显式组件的组件 指导。执行任务“BuildInstaller”时发生错误。错误: 灯:进程返回错误(退出代码 230)。

似乎对于空目录,它必须有一个分配的公会,而不是根据this article的“*”。

我不想用 GUID 手动替换“*”,因为热/光过程与构建过程集成在一起,并且 Files.wxs 在源代码控制中。

你知道如何解决这个错误吗?

【问题讨论】:

    标签: wix


    【解决方案1】:

    您同时使用热量参数 -ag 和 -gg。

    要么我错过了什么,要么

    -ag - 在编译时自动生成组件 guid,例如设置 Guid="*"。

    -gg - 立即生成 guid。运行加热时,所有组件都会有一个指南。

    来源http://wixtoolset.org/documentation/manual/v3/overview/heat.html

    不能同时满足。

    因为在生成 GUID 期间您的灯随后会失效,所以我建议只尝试 -gg 而没有 -ag。这也帮助我处理空目录。

    【讨论】:

      【解决方案2】:

      我添加了这个 sn-p,WiX Light 工作正常。

        <xsl:template match="wix:Directory[@Name='data']/wix:Component/@Guid">
          <xsl:attribute name="Guid">
            <xsl:value-of select="'E8A26678-FA90-4BFC-846F-4E79AE55D44D'"/>
          </xsl:attribute>
        </xsl:template>
      

      如果这是正确的解决方案,请发表评论。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-29
        • 1970-01-01
        • 2018-07-07
        • 1970-01-01
        • 2013-06-21
        相关资源
        最近更新 更多