以下行
<Component Guid='{THE_GUID}' Id='GlobalScopePackages' >
生成以下错误:
Error 4 ICE80: This 64BitComponent GlobalScopePackages uses 32BitDirectory blablabla c:\development\...\file.wxs
此页面描述了错误 http://msdn.microsoft.com/en-us/library/aa369034(VS.85).aspx
如何解决此问题或抑制警告?简单地抑制警告是否安全?
我想要一个 64 位安装程序(根据我的发布配置),因此我使用
<Directory Id="ProgramFiles64Folder">
而不是 ProgramFilesFolder
作为目标安装路径的一部分。
本文提供了更多信息:如何:为 64 位客户端计算机创建 Windows 安装程序包
您还可以在非 64 位组件的
Win64="no"
标签中设置 <Component />
。
但我可以确认你可以忽略这一点。
只需抑制警告即可安全。
我希望能够根据传入的构建参数构建 x86 和 x64 的安装程序。我能够这样做。
请参阅 Alek Davis 的这篇博客文章了解更多信息。
简单示例,在 .wxs 文件中
<?if $(var.Platform) = x64 ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
<Fragment>
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLFOLDER"
Name="X" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="ProductComponent"
Win64="$(var.Win64)">
<File Source="$(var.X.TargetPath)" />
<!-- TODO: Insert files, registry keys, and other resources here. -->
</Component>
</ComponentGroup>
</Fragment>
我今天收到此错误,发现安装程序项目设置为构建为 x64。所有其他项目都是任何 CPU。我只想要一个 x86 安装程序,因此只需将平台更改为 x86 就可以解决这个问题。
显然,如果您想要一个基于 x64 的安装程序,那么上面的答案之一将解决您的问题。
如果有人尝试使用 HEAT 自动执行“组件”创建过程,则没有可用的开关(直到 V3.10)来包含 Win64=yes/no。
将 -arch x64 开关与 Candle 一起使用将解决此问题。
我认为,如果您对 32 位或 64 位进行编程,最好和最简单的方法是按平台定义变量(在本例中为 ProgramFiles):
<Fragment>
<?if $(var.Platform) = x64?>
<?define ProgramFiles = ProgramFiles64Folder ?>
<?else?>
<?define ProgramFiles = ProgramFilesFolder ?>
<?endif?>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles">
<Directory Id="INSTALLFOLDER" Name="ProjName" />
</Directory>
</Directory>
</Fragment>