Tôi đang sử dụng chuỗi WixUI_Advanced để cho phép người dùng chọn mỗi máy hoặc cho mỗi người dùng cài đặt và thay đổi thư mục đích. Dự án WiX của tôi nhằm tạo ra cả hai loại x86 và x64 MSI (Tôi đang sử dụng các đề xuất WiX Tips and Tricks). Tôi cũng giữ cho ứng dụng thư mục cài đặt trong sổ đăng ký để nâng cấp lớn (tôi sử dụng thuộc tính APPLICATIONFOLDER và ID thư mục - thay vì INSTALLLOCATION - theo yêu cầu WixUI_Advanced).WiX: Cách ghi đè "C: Program Files (x86)" trên máy x64 trong chuỗi WixUI_Advanced?
Có một bug in WixUI_Advanced sequence gây hộp thoại Destination Folder để hiển thị các thư mục ứng dụng dưới C: \ Program Files (x86) thay vì C: \ Program Files khi chạy trên một máy tính 64-bit, ngay cả khi mã chính xác đặt thư mục ứng dụng thành thuộc tính ProgramFiles64Folder. Nhận xét theo dõi lỗi đề xuất sử dụng yếu tố SetDirectory để đặt giá trị của APPLICATIONFOLDER, nhưng có không có ví dụ giải thích cách thực hiện điều này. Khi tôi thử, dấu chấm đã tạo ra bất kỳ sự khác biệt nào (tôi cũng đã tìm thấy một số bài đăng đề xuất bằng cách sử dụng một hành động tùy chỉnh để đặt APPLICATIONFOLDER, nhưng không có gì làm việc cho tôi). Có ai biết làm thế nào để làm cho trình tự WixUI_Advanced hiển thị chính xác 'Program Files' thư mục trên một hệ thống 64-bit (và cũng hiển thị các thư mục được lựa chọn ban đầu trong quá trình nâng cấp lớn)?
Nếu trợ giúp, tôi sẽ cung cấp đoạn mã mẫu WXS, nhưng họ thực hiện theo các đề xuất từ bài đăng WiX Tips and Tricks của StackOverflow. Ngoài ra, gói MSI 64 bit của tôi thực sự là một gói 64 bit (tôi có gói và các thành phần được đánh dấu là 'x64'; và nó không chạy trên nền tảng 32 bit) .Tôi đang sử dụng WiX 3.6 và Visual Studio 2010 .
MÃ mẪU:
<?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>
Nhiều nhờ Sascha Beaumont để giải quyết vấn đề này đây là mẫu làm việc:.
<?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>
Cảm ơn Sascha, nhưng có vẻ như nó không hoạt động. Tôi đã cập nhật bài đăng để bao gồm mẫu tệp WXS hoàn chỉnh (nó cài đặt một tệp Readme.txt duy nhất nằm trong thư mục dự án). Khi tôi chạy nó trên một máy chủ Windows 2008 64-bit, hộp thoại đích thư mục vẫn trỏ đến thư mục Program Files (x86). Có điều gì sai với mã không? –
Xin chào Alek, xem bài đăng cập nhật - điều này là ổn với tôi trên Win7 x64 trong thử nghiệm khói 5 phút :) – saschabeaumont
Ngọt ngào !!! Có vẻ như nó đang hoạt động. Cảm ơn rất nhiều, Sascha! –