简体   繁体   English

如何从MSI检查已安装的产品版本

[英]How to check an installed version of a product from MSI

After review a lot of posts in this site finally I decide to put mine. 经过审查,本网站上的很多帖子终于决定放我的。 I am preparing an MSI file with Wix. 我正在准备一个使用Wix的MSI文件。 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. 我有该产品的GUID(所有版本都相同),但我需要检查是否安装了1.10.0版本。 Any idea, please. 请问任何想法。 Thanks in advance. 提前致谢。

PD: I am newbie in Wix, so at this moment I am just using the wxs file created by default with the Setup Project. PD:我是Wix中的新手,所以此时我只是使用默认情况下使用Setup Project创建的wxs文件。

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. 澄清:我不想升级我正在安装的软件,我需要检查安装程序所依赖的其他程序和版本。

To do it properly, you probably want to use a custom action. 要正确执行此操作,您可能希望使用自定义操作。 Inside the custom action, use the MsiGetProductInfo function. 在自定义操作中,使用MsiGetProductInfo函数。

A way of doing it in pure-WiX would be to modify the example found here: How do I compare registry versions in WiX? 在纯WiX中执行此操作的方法是修改此处的示例: 如何比较WiX中的注册表版本?

First create a RegistrySearch element: 首先创建一个RegistrySearch元素:

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

Then use a Condition element: 然后使用Condition元素:

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

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. 这将搜索完全版本1.10.0,所以如果你正在寻找像“v1.10.0或更新”这样的东西可能不是你想要的......但是应该让你开始。

Perhaps try the proposed solution in this post: WiX Installer: getting version of the product being upgraded 也许在这篇文章中尝试提出的解决方案: WiX安装程序:获取正在升级的产品的版本

It involves using the Upgrade table to identify the installed product, and a custom action using VBScript to determine the version. 它涉及使用Upgrade表来标识已安装的产品,以及使用VBScript确定版本的自定义操作。

If you want to do something like create an error message or fail the install if that version is present you can have multiple upgrade entries. 如果您想要执行类似创建错误消息或安装失败的情况(如果存在该版本),则可以有多个升级条目。 Have one that has something like this, bad syntax... 有一个有这样的东西,错误的语法......

<Property Id="VERSION110INSTALLED" Secure="yes" />
<Upgrade Id="YOUR_GUID">
  <UpgradeVersion
   Minimum="1.10.0" Maximum="1.10.0"
   Property="VERSION110SINSTALLED"
   IncludeMinimum="yes" IncludeMaximum="yes" OnlyDetect="yes" />
</Upgrade>

Then you have that property set if version 1.10.0 is present, and if you want to produce an error message condition it on VERSION110SINSTALLED, and sequence it after FindRelatedProducts. 然后,如果存在版本1.10.0,则设置该属性,如果要在VERSION110SINSTALLED上生成错误消息,请在FindRelatedProducts之后对其进行排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bootstrapper:在运行之前检查是否安装了msi版本 - Bootstrapper: Check if msi version is installed before running 如何找到已安装 MSI 设置的产品 G​​UID? - How can I find the product GUID of an installed MSI setup? 如何避免使用 Windows 安装程序/MSI 安装产品的两个版本? - How to avoid having two versions of a product installed with Windows Installer / MSI? 如何在每次创建msi期间动态更改wix中的产品版本 - how to dynamically change product version in wix during each msi creation 如何找出已安装的产品-已安装较新的产品MSI窗口 - how to find out which products are installed - newer product are already installed MSI windows 如果已经使用WiX安装了产品,如何将MSI退出代码设置为0? - How do I set the MSI exit-code to 0 if product is already installed using WiX? Wix-如何从以前安装的MSI获取用户输入? - Wix - How to get user input from a previously installed msi? 如何通过具有相同产品 ID 的已安装 msi 更新 Windows 安装程序包 - How to update Windows installer package over installed msi with same product id 如何找到msi的已安装用户? - How to find installed user of msi? 如果已经安装了MSI,如何继续 - How to continue if an MSI is already installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM