Installshield主要升级不会卸载旧版本 [英] Installshield major upgrade doesn't uninstall old version

查看:72
本文介绍了Installshield主要升级不会卸载旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Installshield项目.

I have an Installshield project.

我添加了一个主要的升级项目,并更改了产品版本产品代码包装代码.

I added a major upgrade item and changed Product version , Product code and Package code.

使用新安装程序安装后,旧版本仍然存在(在添加/删除中)

After the installation with the new installer, the old version is still present (in Add / Remove)

我认为这与以下事实有关:我的旧版本号是 1.0.4.23 ,而新版本号是 1.0.4.24 -这是问题吗?重大升级是否会忽略版本属性中的微小更改?

I think it's related to the fact that my old version number was 1.0.4.23 and new one is 1.0.4.24 - is this a problem? Does major upgrade ignore such a small change in the version property?

在重大升级 common 标签中,我选择了任何早期版本

In major upgrade common tab I chose Any earlier version

我记得几年前用版本号 1.1 1.2 进行过,并且一切正常,这是我怀疑当前问题与版本号有关的主要原因

I remember doing this years ago with version numbers 1.1 and 1.2 and everything worked great, this is the main reason why I suspect the current issue is related to version numbers.

推荐答案

我认为这与我的旧版本号是1.0.4.23,新的是1.0.4.24-这是一个问题吗?重大升级会忽略版本中的微小更改吗?

I think it's related to the fact that my old version number was 1.0.4.23 and new one is 1.0.4.24 - is this a problem? Does major upgrade ignores such a small change in version?

是的,只有版本号的前三个字段对重大升级有意义.只需忽略第四个字段.

Yes, only the first three fields of the version number are significant for major upgrade. The fourth field is simply ignored.

这在.

如果要触发重大升级,则新版本号必须为 1.0.5.0 或更高版本.

If you want to trigger a major upgrade, your new version number must be 1.0.5.0 or greater.

克里斯托弗·画家(Christopher Painter)指出:

As Christopher Painter points out:

如果必须使用所有四个字段,则有一种解决方法.你可以创建一个自定义操作来执行您自己的FindRelatedProducts并使用ProductCode设置action属性然后再对RemoveExistingProducts进行操作.

There is a way around this if you must use all four fields. You can create a custom action that does your own implementation of FindRelatedProducts and sets the action property with a ProductCode that RemoveExistingProducts then acts upon.

自定义操作可以这样实现:

The custom action could be implemented like this:

  1. 致电 MsiGetProperty 来获取产品的 UpgradeCode .
  2. 致电 MsiEnumRelatedProducts() 枚举与您的产品具有相同 UpgradeCode 的所有产品.
  3. 致电 MsiQueryProductState() 来验证是否已实际安装 MsiEnumRelatedProducts()返回的产品.我遇到过某些情况,其中 MsiEnumRelatedProducts()返回了不再安装的孤立产品.因此,通过使用 MsiQueryProductState()再次检查安装状态,代码将更加健壮.
  4. 致电 MsiGetProductInfo() ,其中 INSTALLPROPERTY_VERSIONSTRING 作为 szProperty 参数的参数,以查询已安装产品的版本.不要使用 INSTALLPROPERTY_VERSION ,因为 INSTALLPROPERTY_VERSION 仅从版本号的前三个字段派生,这是我们要避免的问题.
  5. 比较版本号时,请确保您不只是比较字符串,而是将字符串解析到由以下字符分隔的字段中'.'并分别比较各个字段.
  6. 如果找到要替换的匹配产品,请致电动作属性与此产品的 ProductCode 相同,该产品
  1. Call MsiGetProperty to get the UpgradeCode of your product.
  2. Call MsiEnumRelatedProducts() to enumerate all products that have the same UpgradeCode as your product.
  3. Call MsiQueryProductState() to verify that the product(s) returned by MsiEnumRelatedProducts() are actually installed. I experienced some cases where MsiEnumRelatedProducts() returned orphaned products that were no longer installed. So the code will be more robust by double-checking the install state with MsiQueryProductState().
  4. Call MsiGetProductInfo() with INSTALLPROPERTY_VERSIONSTRING as the argument for the szProperty parameter to query the version of the installed product. Don't use INSTALLPROPERTY_VERSION instead, because INSTALLPROPERTY_VERSION is derived from only the first three fields of the version number, the problem which we want to avoid.
  5. When comparing version numbers, make sure you don't just compare the strings, but parse the strings into the fields that are separated by '.' and compare the fields individually.
  6. If you found a matching product that you want to replace, call MsiSetProperty() to set the ActionProperty to the ProductCode of this product that RemoveExistingProducts then acts upon.

这篇关于Installshield主要升级不会卸载旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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