如何从 MSI 检查已安装的产品版本 [英] How to check an installed version of a product from MSI

查看:55
本文介绍了如何从 MSI 检查已安装的产品版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在查看了本网站上的大量帖子后,我最终决定放上我的帖子.我正在用 Wix 准备一个 MSI 文件.在安装我的系统之前,我需要检查是否安装了特定版本的企业产品.我有该产品的 GUID(所有版本都相同),但我需要检查是否安装了 1.10.0 版本.任何想法,请.提前致谢.

After review a lot of posts in this site finally I decide to put mine. I am preparing an MSI file with Wix. I need to check if a particular version of an enterprise product is installed, before to install my system. I have the GUID of that product (which is the same for all versions), but I need to check if 1.10.0 version is installed. Any idea, please. Thanks in advance.

PD:我是 Wix 的新手,所以目前我只是使用安装项目默认创建的 wxs 文件.

PD: I am newbie in Wix, so at this moment I am just using the wxs file created by default with the Setup Project.

澄清:我不想升级我正在安装的软件,我需要检查我的安装程序所依赖的另一个程序和版本.

Clarifying: I don't want to upgrade the software that I am installing, I need to check another program and version which my installer depends.

推荐答案

要正确执行此操作,您可能需要使用自定义操作.在自定义操作中,使用 MsiGetProductInfo 函数.

To do it properly, you probably want to use a custom action. Inside the custom action, use the MsiGetProductInfo function.

在纯 WiX 中执行此操作的一种方法是修改此处找到的示例:如何比较 WiX 中的注册表版本?

A way of doing it in pure-WiX would be to modify the example found here: How do I compare registry versions in WiX?

首先创建一个 RegistrySearch 元素:

First create a RegistrySearch element:

<Property Id="PRODUCTVERSION">
    <RegistrySearch Id="ProductVersionSearch" Root="HKLM" Key="software\Microsoft\Windows\Current Version\Uninstall\[PRODUCTCODE]" Name="DisplayVersion" Type="raw" />
</Property>

然后使用 Condition 元素:

Then use a Condition element:

<Condition Message="Product version 1.10.0 must be installed">
    <![CDATA[PRODUCTVERSION AND PRODUCTVERSION = "1.10.0"]]>
</Condition>

这将准确搜索 1.10.0 版,因此如果您正在寻找诸如v1.10.0 或更高版本"之类的内容,这可能不是您想要的……但应该可以帮助您入门.

This would search for exactly version 1.10.0, so may not be what you want if you're looking for something like "v1.10.0 or newer"... But should get you started.

这篇关于如何从 MSI 检查已安装的产品版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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