WIX - 注册表搜索返回错误的安装位置

发布于 2024-09-16 11:36:00 字数 1473 浏览 3 评论 0原文

我的 WIX 安装程序将检查以前安装的软件版本。如果有较旧的安装,则应将其安装在同一路径中。我正在使用RegistrySearch 来执行此检查。

<Property Id="TARGETDIR">
    <RegistrySearch Id="InstallLocation" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ANYVERSION]" Name="InstallLocation" Type="directory" Win64="no" />
</Property>


中定义

<Upgrade Id="MyGUID">
    <UpgradeVersion Property="OLDVERSION" IncludeMinimum="yes" IncludeMaximum="no" Maximum="$(var.VERSION)" Minimum="0.0.0.0" OnlyDetect="no" />
    <UpgradeVersion Property="NEWVERSION" IncludeMinimum="no" Minimum="$(var.VERSION)" Maximum="99.99.99.99" IncludeMaximum="no" OnlyDetect="yes" />
    <UpgradeVersion Property="EQUALVERSION" IncludeMinimum="yes" Minimum="$(var.VERSION)" Maximum="$(var.VERSION)" IncludeMaximum="yes" OnlyDetect="yes" />
    <UpgradeVersion Property="ANYVERSION" IncludeMinimum="yes" Minimum="0.0.0.0" Maximum="99.99.99.99" IncludeMaximum="yes" OnlyDetect="yes" />
</Upgrade>

其中 [ANYVERSION] 在
当我的软件已经安装了另一个版本时,我的检查工作正常。
当我的软件没有较早安装时,检查会正常工作,但有一个例外:当安装了另一个应用程序时,该应用程序在 installLocation 中写入了一个没有子节点 (GUID) 的条目(名为 installLocation)。 >HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 检查返回此应用程序的安装位置

我的支票有什么问题吗?
为什么RegistrySearch 返回没有子节点的条目的installLocation?
是否有可能使其与registrySearch一起使用,或者我是否需要编写自己的CustomAction?

My WIX-installer shall check for a previously installed version of the software. If there is an older installation it shall be installed in the same path. I'm using RegistrySearch to perform this check.

<Property Id="TARGETDIR">
    <RegistrySearch Id="InstallLocation" Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ANYVERSION]" Name="InstallLocation" Type="directory" Win64="no" />
</Property>

where [ANYVERSION] is defined in

<Upgrade Id="MyGUID">
    <UpgradeVersion Property="OLDVERSION" IncludeMinimum="yes" IncludeMaximum="no" Maximum="$(var.VERSION)" Minimum="0.0.0.0" OnlyDetect="no" />
    <UpgradeVersion Property="NEWVERSION" IncludeMinimum="no" Minimum="$(var.VERSION)" Maximum="99.99.99.99" IncludeMaximum="no" OnlyDetect="yes" />
    <UpgradeVersion Property="EQUALVERSION" IncludeMinimum="yes" Minimum="$(var.VERSION)" Maximum="$(var.VERSION)" IncludeMaximum="yes" OnlyDetect="yes" />
    <UpgradeVersion Property="ANYVERSION" IncludeMinimum="yes" Minimum="0.0.0.0" Maximum="99.99.99.99" IncludeMaximum="yes" OnlyDetect="yes" />
</Upgrade>

My check works fine when there is already another version of my software installed.
When there is no earlier installation of my software, the checks works as well with one exception: when there is another application installed which writes an entry (with the name installLocation) without subnode (GUID) in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall the check returns the installLocation of this application.

What is wrong in my check?
Why is RegistrySearch returning the installLocation of the an entry without a subnode?
Is there a possibility to make this work with registrySearch, or do I need to write my own CustomAction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

做个ˇ局外人 2024-09-23 11:36:00

这是因为如果没有找到,ANYVERSION 将为空,然后路径将被评估为 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall。

一种解决方案(虽然不太优雅)是在另一个属性中捕获注册表搜索,并且仅设置应包含您的安装目录的属性(TARGETDIR 在这里可能也不是正确的选择)如果定义了 ANYVERSION,则通过属性设置自定义行动。

That's because ANYVERSION will be empty if none is found, and the path will then be evaluated to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall.

One solution (not too elegant though) is to capture the registry search in another property, and only set the property that should contain your installation directory (TARGETDIR is probably not the correct choice here either) if ANYVERSION is defined, through a property settings custom action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文