gpt4 book ai didi

WiX 刻录 : Reading LaunchTarget from Registry

转载 作者:行者123 更新时间:2023-12-04 23:42:24 26 4
gpt4 key购买 nike

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

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

但是,获取可执行文件的路径对我来说并不容易。这样做的原因是因为我使用 来安装一些先决条件,然后是一个实际安装我的 exe 的 msi。

为此,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 安装。这能做到吗?如果没有,我有什么选择?

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

最佳答案

RegistrySearches 在检测操作期间运行。自定义 BA 可以在应用后运行检测,但这并不是一个真正的选择,因为您使用的是 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 刻录 : Reading LaunchTarget from Registry,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26875058/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com