我使用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