【问题标题】:WiX Heat.exe Win64 Components - Win64="yes"WiX Heat.exe Win64 组件 - Win64="yes"
【发布时间】:2014-04-08 09:30:01
【问题描述】:

我目前正在构建一个仅针对 64 位机器的安装程序。该过程的一部分涉及运行Heat.exe 以生成包含部分已部署应用程序的Fragment 元素。

问题是由热量产生的组件产生 ICE:80 错误,这是 WiX 抱怨这些组件针对 32 位系统,而我的安装程序正试图将它们加载到:

<Directory Id="ProgramFiles64Folder">

查看文档有一个-platform 开关,可以用来告诉Heat 我们的目标是x64 环境,但是文档中没有关于如何使用这个开关的线索。我试过了:

-platform=x64

-platform=Win64

为了在生成的组件上设置Win64 属性,似乎没有什么影响输出。有没有人弄清楚这一点?还是我完全找错了树?

如果我手动编辑收获的组件以添加Win64="yes",ICE 错误就会消失。

在我的&lt;Product&gt; 元素中,我有Platform="x64",据我所知,candle 应该接受这个并计算出组件应该默认设置为 x64,但这似乎不起作用。

很困惑。

【问题讨论】:

  • 我现在已经通过使用 .wixproj 文件中的 InstallerPlatform 属性来完成这项工作。这与在命令行中设置-arch 开关相同。
  • 在这种情况下我通常会做什么:在 heat-commandline 上使用 XSLT 文件,它将 Win64='yes'-attribute 添加到每个组件。即便如此,我总是使用arch-parameter 和platform-property,只是为了确定。如果您需要适当的 XSLT 文件,我会在答案中发布(因为评论太短)。

标签: wix windows-installer


【解决方案1】:

这里是 XSLT 文件。将其保存为例如HeatTransform.xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:wix="http://schemas.microsoft.com/wix/2006/wi"
    xmlns="http://schemas.microsoft.com/wix/2006/wi"
  exclude-result-prefixes="wix">

  <xsl:output method="xml" encoding="UTF-8" indent="yes" />

  <xsl:template match="wix:Wix">
    <xsl:copy>
      <!-- The following enters the directive for adding the config.wxi include file to the dynamically generated file -->
      <!--xsl:processing-instruction name="include">$(sys.CURRENTDIR)wix\config.wxi</xsl:processing-instruction-->
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>

  <!-- ### Adding the Win64-attribute to all Components -->
  <xsl:template match="wix:Component">

    <xsl:copy>
      <xsl:apply-templates select="@*" />
        <!-- Adding the Win64-attribute as we have a x64 application -->
        <xsl:attribute name="Win64">yes</xsl:attribute>

        <!-- Now take the rest of the inner tag -->
        <xsl:apply-templates select="node()" />
    </xsl:copy>

  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

然后,在您的heat-命令行中添加参数-t &lt;PathToYourFile&gt;\HeatTransform.xslt。这会将Win64-属性添加到每个组件。 此外,我的 WiX 源文件中有Platform='x64'-attribute,并将-arch x64-参数添加到candle 的调用中,正如您在问题中已经描述的那样。

【讨论】:

  • 唯一适合我的解决方案!
【解决方案2】:

我也有这个问题。 以下是我所做的,它有所帮助。

1)

在记事本中打开.wixproj文件,手动将PropertyGroup-s中的Condition-s改为“x64”而不是“x86”:

<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
...
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
...
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
...

2)

转到配置管理器以获取解决方案,并确保选择 x64 作为 Wix 项目的平台。

虽然Heat在没有Win64="yes"的情况下仍然会生成Component节点,但它构建正常并安装到C:\Program Files!

【讨论】:

  • 在我看来应该使用InstallerPlatform 来代替Platform
  • FWIW,你没有改变条件(它仍然是平台为空)你改变了分配的值。
【解决方案3】:

Package Elementcandle task 的文档建议使用 InstallerPlatform 属性:

平台

软件包支持的平台。不鼓励使用此属性; 而是在candle.exe 命令行中指定-arch 开关或 .wixproj MSBuild 项目中的 InstallerPlatform 属性。

安装程序平台

指定包的处理器架构。 [...] 这是 相当于candle.exe中的-arch开关。

即:

<PropertyGroup>
  <InstallerPlatform>x64</InstallerPlatform>
</PropertyGroup>

为了完整性:如果您想要一个适用于多个目标平台的 WiX-Project,您应该查看Platform identification in WiX 3.0

【讨论】:

  • 谢谢,只需添加这 3 行对我有用 (&lt;PropertyGroup&gt; &lt;Installer...)
  • 我这样做了,我看到输出中出现了一个 -arch 开关,但它仍然不起作用。 -arch x86 仍然写入 System 64 文件夹,而不是 System32 :(
【解决方案4】:

在 Visual Studio 中:

  1. 选择项目属性
  2. 选择“工具设置”选项卡
  3. 在“附加参数(编译器)”中输入:-arch x64

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-03
    • 2010-09-05
    • 2014-10-16
    • 1970-01-01
    • 1970-01-01
    • 2011-11-20
    • 2012-02-11
    • 2015-03-14
    相关资源
    最近更新 更多