2011-03-29 10 views
11

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 x86x64 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> 

Trả lời

9

Something như thế này có lẽ sẽ làm các trick:

<MajorUpgrade AllowSameVersionUpgrades="yes" 
      DowngradeErrorMessage="Can't downgrade." 
      Schedule="afterInstallInitialize" /> 


<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> 


<CustomAction Id="Overwrite_WixSetDefaultPerMachineFolder" Property="WixPerMachineFolder" Value="[ProgramFiles64Folder][ApplicationFolderName]" Execute="immediate" /> 
<InstallUISequence> 
    <Custom Action="Overwrite_WixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" /> 
</InstallUISequence> 
<InstallExecuteSequence> 
    <Custom Action="Overwrite_WixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" /> 
</InstallExecuteSequence> 

<SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" /> 

UPDATE:SetDirectory lịch trình hành động trước khi WixSetDefaultPerMachineFolder - mã cập nhật cho các yếu tố tự lên kế hoạch để sắp xếp giữa WixSetDefaultPerMachineFolderWixSetPerMachineFolder. Tested OK với mẫu mã OP dưới Win7 x64

UPDATE2: gia tăng hành động để thiết lập ARPINSTALLOCATION như http://robmensching.com/blog/posts/2011/1/14/ARPINSTALLLOCATION-and-how-to-set-it-with-the-WiX-toolset

+0

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? –

+0

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

+0

Ngọt ngào !!! Có vẻ như nó đang hoạt động. Cảm ơn rất nhiều, Sascha! –

0

Tôi nghĩ rằng bạn cần phải đặt Win64 tài sản để Yes cho một trong các nút.

+1

Nó đã được đặt thành Win64 = "có" trên tất cả các thành phần (đối với bản dựng x64). –

6

tôi đã phải thay đổi hai điều cần làm WIX đặt ứng dụng 64-bit của tôi trong thư mục Program Files:

A. Trong các yếu tố WIX trọn gói, thêm 'vBulletin = "x64"':

& lsaquo; Mô tả gói = "desc ..."Nhà sản xuất =" công ty ..." InstallerVersion = "200" vBulletin = "x64" nén = "yes"/ & rsaquo;

B. Trong các yếu tố Directory cho thư mục hàng đầu, thay đổi ProgramFilesFolder để ProgramFiles64Folder:

& lsaquo; Id thư mục = "ProgramFiles64Folder "Name =" PFiles" & rsaquo;

(tôi cũng đã phải bao gồm & lsaquo; tên chương trình & rsaquo; tập tin .exe.config trong thư mục cho chương trình để hoạt động chính xác)

+0

Điều này không hoạt động khi sử dụng 'WixUI_Advanced' theo quy định của OP. –