我使用WixUI_Advanced序列,以允许用户随到随每台机器或每个用户安装和更改目标文件夹。我的WiX项目旨在生产x86和x64 MSI(我正在使用WiX Tips and Tricks建议)。我还将重要升级(我使用APPLICATIONFOLDER属性和目录ID - 而不是INSTALLLOCATION - 根据WixUI_Advanced要求)的应用程序安装文件夹保存在注册表中。WiX:如何在WixUI_Advanced序列中覆盖x64机器上的“C: Program Files(x86)”?
有一个bug in WixUI_Advanced sequence引起目标文件夹对话框下C到显示该应用文件夹:\程序文件(x86)代替C:\ Program Files文件 64位机器上运行时,即使当代码正确设置应用程序文件夹为ProgramFiles64Folder属性。错误跟踪器注释建议使用SetDirectory元素来设置APPLICATIONFOLDER的值,但有没有示例解释如何执行此操作。当我尝试时,它确实有点改变(我还发现一些推荐使用自定义操作来设置APPLICATIONFOLDER的帖子,但没有一个适合我)。有谁知道如何在64位系统上使WixUI_Advanced序列显示正确的“Program Files”文件夹(并在重大升级期间显示最初选定的文件夹)?
如果有帮助,我会提供示例WXS片段,但他们几乎都遵循StackOverflow的WiX Tips and Tricks后的建议。另外,我的64位MSI软件包实际上是一个64位软件包(我的软件包和组件标记为“x64”,并且不能在32位平台上运行),我使用的是WiX 3.6和Visual Studio 2010 。
代码示例:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="81955f17-31f3-4e51-8294-372f96141c00"
Name="WiX64BitDemo"
Language="1033"
Version="1.0.0.0"
Manufacturer="Test"
UpgradeCode="5bed9777-bea6-4dc3-91d7-5dd93819563a">
<Package
InstallerVersion="300"
Compressed="yes"
InstallScope="perMachine"
Platform="x64" />
<MajorUpgrade
AllowSameVersionUpgrades="no"
DowngradeErrorMessage="Can't downgrade."
Schedule="afterInstallInitialize" />
<Media
Id="1"
Cabinet="media1.cab"
EmbedCab="yes" />
<Property Id="APPLICATIONFOLDER" Secure="yes">
<RegistrySearch Id="FindInstallLocation"
Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[WIX_UPGRADE_DETECTED]"
Name="InstallLocation"
Type="raw"
Win64="yes" />
</Property>
<Property Id="ApplicationFolderName" Value="WiX64BitDemo" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<SetDirectory
Id="APPLICATIONFOLDER"
Value="[ProgramFiles64Folder][ApplicationFolderName]">APPLICATIONFOLDER=""</SetDirectory>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="APPLICATIONFOLDER" Name="WiX64BitDemo">
<Component
Id="ReadmeComponent"
Guid="*"
Win64="yes">
<File
Id="ReadmeFile"
Name="readme.txt"
Source="$(var.ProjectDir)readme.txt"
KeyPath="yes"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WiX64BitDemo" Level="1">
<ComponentRef Id="ReadmeComponent" />
</Feature>
<UI Id="UISequence">
<UIRef Id="WixUI_Advanced"/>
</UI>
</Product>
</Wix>
非常感谢萨沙博蒙特解决这个问题下面是工作样例:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="81955f17-31f3-4e51-8294-372f96141c00"
Name="WiX64BitDemo"
Language="1033"
Version="1.0.0.0"
Manufacturer="Test"
UpgradeCode="5bed9777-bea6-4dc3-91d7-5dd93819563a">
<Package
InstallerVersion="300"
Compressed="yes"
InstallScope="perMachine"
Platform="x64" />
<MajorUpgrade
AllowSameVersionUpgrades="no"
DowngradeErrorMessage="Can't downgrade."
Schedule="afterInstallInitialize" />
<Media
Id="1"
Cabinet="media1.cab"
EmbedCab="yes" />
<Property Id="APPLICATIONFOLDER" Secure="yes">
<RegistrySearch Id="FindInstallLocation"
Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[WIX_UPGRADE_DETECTED]"
Name="InstallLocation"
Type="raw"
Win64="yes" />
</Property>
<Property Id="ApplicationFolderName" Value="WiX64BitDemo" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<SetDirectory
Id="APPLICATIONFOLDER"
Value="[ProgramFiles64Folder][ApplicationFolderName]">APPLICATIONFOLDER=""</SetDirectory>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="APPLICATIONFOLDER" Name="WiX64BitDemo">
<Component
Id="ReadmeComponent"
Guid="*"
Win64="yes">
<File
Id="ReadmeFile"
Name="readme.txt"
Source="$(var.ProjectDir)readme.txt"
KeyPath="yes"/>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WiX64BitDemo" Level="1">
<ComponentRef Id="ReadmeComponent" />
</Feature>
<UI Id="UISequence">
<UIRef Id="WixUI_Advanced"/>
</UI>
<CustomAction
Id="OverwriteWixSetDefaultPerMachineFolder"
Property="WixPerMachineFolder"
Value="[APPLICATIONFOLDER]"
Execute="immediate"
/>
<CustomAction
Id="SetARPINSTALLLOCATION"
Property="ARPINSTALLLOCATION"
Value="[APPLICATIONFOLDER]"
/>
<InstallUISequence>
<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
<Custom Action="SetARPINSTALLLOCATION" After="InstallValidate"/>
</InstallExecuteSequence>
</Product>
</Wix>
谢谢Sascha,但它似乎没有工作。我更新了文章以包含完整的WXS文件示例(它安装位于项目文件夹中的单个Readme.txt文件)。当我在64位Windows 2008 Server上运行它时,“目标文件夹”对话框仍然指向Program Files(x86)文件夹。代码有什么问题吗? – 2011-03-30 20:35:30
嗨阿列克,看到更新的帖子 - 这对我来说在Win7 x64上5分钟冒烟测试:) – saschabeaumont 2011-04-07 04:10:53
甜!看起来像是在工作。谢谢,Sascha! – 2011-04-07 20:15:26