Wix - 如何从注册表获取安装路径时如何避免BrowseDlg

时间:2014-07-03 14:06:39

标签: wix

我正在使用wix编写安装程序来安装我的应用程序。我想从注册表中获取安装路径,而不是允许用户从WixUI_InstallDir的BrowseDlg中进行选择。为此,我正在做一个RegistrySearch并试图获取InstallPath的值。我的目标是,如果在注册表中找到InstallPath,我想在安装过程中单独跳过BrowseDlg,如果找不到InstallPath,则显示BrowseDlg。我怎样才能做到这一点?请指教。

这是我的代码段 -

<Product Name="$(var.ProductName)" Id="*"
           UpgradeCode="$(var.UpgradeCode)"
           Language="1033" Codepage="1252"
           Version="$(var.ProductVersion)"
           Manufacturer="xxx" >

    <Package Id="*" Keywords="Installer" InstallerVersion="200"
             Comments="$(var.ProductName) - $(var.ProductVersion)"
             InstallPrivileges="elevated" Compressed="yes" InstallScope="perMachine" />
    <!--MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." /-->
    <Media Id="1" Cabinet="xxx.cab" EmbedCab="yes" />
    <Property Id="INSTALLFOLDER">
      <RegistrySearch Id='InstallLocation' Type='raw'
        Root='HKCU' Key='Software\xx\yy' Name='InstallPath' />
    </Property>
    <UIRef Id="WixUI_InstallDir"/>
    <PropertyRef Id="NETFRAMEWORK35"/>
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
    <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>

Edit1:使用上面的代码,我可以从安装程序日志中看到在AppSearch操作期间使用InstallPath值(从注册表中读取)设置了INSTALLFOLDER属性,但仍然在安装期间显示BrowseDlg。我的理解是,只有在没有设置INSTALLFOLDER的值时才会显示BrowseDlg。不是这样吗?请指教。

0 个答案:

没有答案
相关问题