WiX: How to override “C:\Program Files (x86)” on x64 machine in WixUI_Advanced sequence?

前端 未结 3 1516
独厮守ぢ
独厮守ぢ 2021-02-04 07:05

I\'m using WixUI_Advanced sequence to allow users pick per-machine or per-user installation and change destination folder. My WiX project is i

相关标签:
3条回答
  • 2021-02-04 07:36

    I think you need to set the Win64 property to Yes for one of the nodes.

    0 讨论(0)
  • 2021-02-04 07:53

    Something like this would probably do the 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 schedules the action prior to WixSetDefaultPerMachineFolder - code updated for manually scheduled elements to schedule between WixSetDefaultPerMachineFolder and WixSetPerMachineFolder. Tested OK with OP sample code under Win7 x64

    UPDATE2: Added action to set ARPINSTALLOCATION as http://robmensching.com/blog/posts/2011/1/14/ARPINSTALLLOCATION-and-how-to-set-it-with-the-WiX-toolset

    0 讨论(0)
  • 2021-02-04 07:53

    I had to change two things to make WIX put my 64-bit app in the Program Files folder:

    A. In the WIX Package element, add 'Platform="x64"':

    ‹Package Description="desc..." Manufacturer="company..." InstallerVersion="200" Platform="x64" Compressed="yes" /›

    B. In the Directory element for the top folder, change ProgramFilesFolder to ProgramFiles64Folder:

    ‹Directory Id="ProgramFiles64Folder" Name="PFiles"›

    (I also had to include the ‹program name› .exe.config file in the folder for the program to work correctly)

    0 讨论(0)
提交回复
热议问题