WiX Burn:从注册表读取 LaunchTarget [英] WiX Burn: Reading LaunchTarget from Registry

查看:23
本文介绍了WiX Burn:从注册表读取 LaunchTarget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 WiX 新手,我正在尝试让 Bootstrapper 在它完成时启动我安装的应用程序.为了实现这一点,我正在使用

I'm new with WiX, and I'm trying to have my Bootstrapper launch my installed application when it completes. To accomplish this, I'm using

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

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

However, it is not easy for me to get the path to the executable. The reason for this is because I'm using <Chain> to install some pre-requisites and then an msi that actually installs my exe.

为此,msi 将写入注册表中已知位置的路径,然后引导程序读取并使用它.

So to do this, the msi is writting the path to a known location in the registry, and then the bootstrapper reads it and uses it.

问题是bootstrapper读取注册表的时候,msi还没有运行,所以最后无法运行可执行文件.

The problem is that when the bootstrapper reads the registry, the msi hasn't run yet, so it is unable to run the executable at the end.

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

Here's my WiX, if it helps:

<?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>

所以,简而言之,我正在尝试在安装 MsiPackage 之后之后运行 RegistrySearch.这能做到吗?如果没有,我有什么选择?

So, in short, I'm trying to have the RegistrySearch run AFTER the MsiPackage installs. Can this be done? If not, what alternatives do I have?

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

As I side note, if I manually fill in the registry value before installation, everything works fine. This means that besides the order things are running in, everything is working fine.

推荐答案

RegistrySearches 在 Detect 操作期间运行.自定义 BA 可以在应用后运行检测,但这并不是一个真正的选择,因为您使用的是 WixStandardBootstrapperApplication.

RegistrySearches run during the Detect operation. Custom BAs could run Detect after Apply, but that's not really an option since you're using the WixStandardBootstrapperApplication.

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

Lucky for you, WiX v3.9 added support for running the LaunchTarget already elevated, with the requirement that the path to the target .exe be in the registry under HKLM. So you would do this:

<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 将首先尝试注册位置),但您不能使用 内置变量 和/或 MsiProperty 元素来定位exe?

It looks like you are required to set LaunchTarget as well. Why doesn't your bundle know where it will be? You can just put in gibberish for LaunchTarget (WixStdBA will try the registry location first), but can't you use built-in variables and/or MsiProperty elements to locate the exe?

这篇关于WiX Burn:从注册表读取 LaunchTarget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆