问题描述
我正在编写一个简单的代码来在 Program Files
文件夹中安装文件,而不是 Program Files (x86)
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="Del">
<Directory Id="MyFolder" Name="MyFolder"/>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<Component Id="Component1" Directory="MyFolder" Win64="yes">
<File Id="FirstFile.txt"/>
</Component>
</Fragment>
基本上它应该在 del
中创建一个文件夹 Program Files
并在其中创建文件夹 MyFolder
,其中将包含 FirstFile.txt
如果我为 Id = ProgramFilesFolder
做它,它通过安装在 Program Files (x86)
将其更改为 ProgramFiles64Folder
会出现以下错误
ICE80: This package contains 64 bit component 'Component1' but the Template Summary Property does not contain Intel64 or x64.
提前致谢
解决方法
在candle.exe 命令行或.wixproj MSBuild 项目中的InstallerPlatform 属性中指定-arch 开关。当您指定 x64 或 intel64 时,Candle 会自动将正在编译的文件中的包和组件设置为 64 位。
,Arnson 的方法:请查看来自 Bob Arnson 的答案。以下是他博客的摘录:“通常希望从同一个 WiX 源生成 32 位和 64 位包,因此常用方法是将 @Win64 属性值设为 {{3} }." 因此,他使用编译器开关来编译来自同一来源的 x32 或 x64 位版本的 MSI 文件。
并且不:您不能同时支持具有一个 MSI 的架构。从 preprocessor variable 查看此博客:Heath Stewart。
“硬编码”方式:这是您可以尝试的旧示例: Different Packages are Required for Different Processor Architectures
部分摘录:
包元素:
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
组件元素:
<Component Feature="ProductFeature" Win64="yes">
<File Source="$(env.SystemRoot)\notepad.exe" />
</Component>