Ale*_*vis 14 windows-installer wix wix3.6
我正在使用WixUI_Advanced序列来允许用户选择每台机器或每用户安装并更改目标文件夹.我的WiX项目旨在生产x86和x64 MSI(我正在使用WiX提示和技巧建议).我还将应用程序安装文件夹保留在注册表中以进行主要升级(我使用APPLICATIONFOLDER属性和目录ID - 而不是INSTALLLOCATION - 根据WixUI_Advanced要求).
WixUI_Advanced序列中存在一个错误,导致目标文件夹对话框在64位计算机上运行时在C:\ Program Files(x86)下显示app文件夹而不是C:\ Program Files,即使代码正确设置了app文件夹到ProgramFiles64Folder属性.错误跟踪器注释建议使用SetDirectory元素来设置APPLICATIONFOLDER的值,但没有解释如何执行此操作的示例.当我尝试时,它确实有点不同(我还发现一些帖子建议使用自定义动作设置APPLICATIONFOLDER,但没有一个对我有效).有谁知道如何使WixUI_Advanced序列在64位系统上显示正确的'Program Files'文件夹(并在主要升级期间显示最初选择的文件夹)?
如果它有帮助,我将提供示例WXS片段,但它们几乎遵循StackOverflow的WiX提示和技巧帖子的建议.此外,我的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>
非常感谢Sascha Beaumont解决这个问题.这是工作样本:
<?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>
sas*_*ont 14
像这样的东西可能会成功:
<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" />
更新: SetDirectory调度之前的操作WixSetDefaultPerMachineFolder- 为手动调度的元素更新代码以在WixSetDefaultPerMachineFolder和之间进行调度WixSetPerMachineFolder.在Win7 x64下使用OP示例代码进行了测试
UPDATE2:添加了设置ARPINSTALLOCATION为http://robmensching.com/blog/posts/2011/1/14/ARPINSTALLLOCATION-and-how-to-set-it-with-the-WiX-toolset的操作
我不得不改变两件事来让WIX将我的64位应用程序放在Program Files文件夹中:
A.在WIX Package元素中,添加'Platform ="x64"':
<Package Description ="desc ..."Manufacturer ="company ..."InstallerVersion ="200" Platform ="x64" Compressed ="yes"/>
B.在顶级文件夹的Directory元素中,将ProgramFilesFolder更改为ProgramFiles64Folder:
<Directory Id =" ProgramFiles64Folder "Name ="PFiles">
(我还必须在文件夹中包含<program name> .exe.config文件才能使程序正常工作)