WiX Burn:从Registry中读取LaunchTarget

Rob*_*Rob 3 wix burn

我是WiX的新手,我正在尝试让我的Bootstrapper在完成时启动我安装的应用程序.要做到这一点,我正在使用

<Variable Name="LaunchTarget" Value="path_to_exe"/>
Run Code Online (Sandbox Code Playgroud)

但是,我不容易获得可执行文件的路径.这是因为我使用<Chain>来安装一些先决条件,然后是一个实际安装我的exe的msi.

所以要做到这一点,msi正在写入注册表中已知位置的路径,然后引导程序读取并使用它.

问题是当引导程序读取注册表时,msi尚未运行,因此无法在最后运行可执行文件.

这是我的WiX,如果它有帮助:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Bundle Name="My Installation" UpgradeCode="a8964402-f3fc-4878-aafd-31ecda6b685e" Version="1.0.0.0">
        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
            <bal:WixStandardBootstrapperApplication LicenseFile="EULA.rtf"
                                                    ThemeFile="theme.xml"
                                                    SuppressOptionsUI="yes" />
        </BootstrapperApplicationRef>
        <Chain>
            <PackageGroupRef Id="NetFx40Redist"/>
            <ExePackage Id="OpenSSL" SourceFile="pre-requesite.exe" />
            <MsiPackage Id="myInstall" SourceFile="mySetup.msi" />
        </Chain>
        <util:RegistrySearch Root="HKLM"
                             Key="Software\myProgram"
                             Value="myEXEPath"
                             Variable="myEXEPath"
                             Result="value"
                             Format="raw" />
        <Variable Name="LaunchTarget" Value="[myEXEPath]"/>
    </Bundle>
</Wix>
Run Code Online (Sandbox Code Playgroud)

所以,简而言之,我想在MsiPackage安装之后运行RegistrySearch .可以这样做吗?如果没有,我有什么替代品?

我注意到,如果我在安装之前手动填写注册表值,一切正常.这意味着除了订单运行之外,一切都运行良好.

Sea*_*all 5

RegistrySearches在Detect操作期间运行.自定义BA可以在Apply之后运行Detect,但由于您使用的是WixStandardBootstrapperApplication,因此这不是一个真正的选项.

幸运的是,WiX v3.9增加了对已经提升的LaunchTarget的支持,并要求目标.exe的路径位于HKLM下的注册表中.所以你会这样做:

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
    <bal:WixStandardBootstrapperApplication LicenseFile="EULA.rtf"
                                            ThemeFile="theme.xml"
                                            SuppressOptionsUI="yes"
                                            LaunchTargetElevatedId="MyAEEId" />
</BootstrapperApplicationRef>
<ApprovedExeForElevation Id="MyAEEId" 
                         Key="Software\myProgram" Value="myEXEPath" />
Run Code Online (Sandbox Code Playgroud)

编辑:

看起来你也需要设置LaunchTarget.为什么你的捆绑包不知道它会在哪里?你可以直接输入LaunchTarget(WixStdBA将首先尝试注册表位置),但是你不能使用内置变量和/或MsiProperty元素来定位exe吗?