我是WiX的新手,我正在尝试让Bootstrapper在安装完成后启动安装的应用程序。为此,我正在使用

<Variable Name="LaunchTarget" Value="path_to_exe"/>

但是,要获得可执行文件的路径对我来说并不容易。这样做的原因是因为我正在使用安装一些必备组件,然后使用msi实际安装了我的exe。

因此,MSI在注册表中写入到已知位置的路径,然后 bootstrap 读取并使用它。

问题是,当 bootstrap 读取注册表时,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>

因此,简而言之,我试图让RegistrySearch运行MsiPackage安装的 AFTER 。能做到吗?如果没有,我有什么选择?

正如我所指出的那样,如果在安装之前手动填写注册表值,则一切正常。这意味着,除了按顺序运行外,一切都运行良好。

最佳答案

RegistrySearches在检测操作期间运行。自定义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" />

编辑:

看来您也需要设置LaunchTarget。为什么您的捆绑包不知道它将在哪里?您可以仅输入LaunchTarget的乱码(WixStdBA将首先尝试注册表位置),但是您不能使用built-in variables和/或 MsiProperty 元素来定位exe吗?

关于WiX Burn : Reading LaunchTarget from Registry,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26875058/

10-11 22:13
查看更多