使用 wix 安装较新版本的 msi 时从程序和功能中删除程序 [英] remove program from programs and features when installing newer version msi using wix

查看:27
本文介绍了使用 wix 安装较新版本的 msi 时从程序和功能中删除程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WIX 创建我的安装程序 msi.当我安装较新版本的应用程序时,我的旧应用程序已经安装在机器上,然后它删除了旧版本的所有文件和程序集,并放置了新版本的文件和程序集,但在控制面板的程序和功能中显示了旧版本和新版本.

I am creating my installer msi using WIX. My older application is already installed on machine when I am installing newer version of the application then it removes all files and assembly of older version and put newer version files and assembly but in programs and features of control panel shows both older and newer version.

我正在使用以下代码进行升级

I am using following code for upgrade

 <Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Language="!(loc.lcid)" Property="NEWPRODUCTFOUND"/>
  <UpgradeVersion Minimum="1.0.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Language="!(loc.lcid)" Property="UPGRADEFOUND"/>
</Upgrade>

 <CustomAction Id="PreventDowngrading" Error="!(loc.CustomAction_PreventDowngrading)"/>

<InstallUISequence>
  <Custom Action="SetWindowsTypeProp" Before="FindRelatedProducts">1</Custom>
  <!--Custom Action="SetPresenceProperties" After="SetWindowsTypeProp">1</Custom-->
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>


<InstallExecuteSequence>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <RemoveExistingProducts Before="InstallInitialize"/>
</InstallExecuteSequence>

请帮助我如何从程序和功能中删除条目

Please help me how to remove entry from programs and features

推荐答案

这意味着您的 MajorUpgrade 无法正常工作.FindRelatedProducts 找不到旧版本,因此 REmoveExistingProducts 不起作用.对于最新版本的 WiX,您可以删除大量此代码并将其替换为较新的 MajorUpgrade 元素.这是一种更高级别的抽象,可简化大部分创作过程.

This means your MajorUpgrade isn't working. FindRelatedProducts isn't finding the older version and therefore REmoveExistingProducts isn't working. For recent versions of WiX you can remove a lot of this code and replace it with the newer MajorUpgrade element. It's a higher level abstraction that simplifies much of this authoring.

为了让 MajorUpgrade 成功,有几件事必须发生:

In order to have a successful MajorUpgrade several things have to happen:

1) 新旧 MSI 必须具有相同的 UpgradeCode GUID.(尽管 MSI 在技术上可以通过使用额外的 UpgradeCode 属性来删除不相关的产品,但在此问题中,我们将忽略这一点.)

1) Old and New MSI have to have the same UpgradeCode GUID. (Although it's technically possible for an MSI to remove unrelated Products by using additional UpgradeCode properties we'll ignore this for the purpose of this question.)

2) 旧的和新的 MSI 必须具有唯一的 ProductCode GUID.

2) Old and New MSI must have unique ProductCode GUIDs.

3) 新 MSI 必须具有更高版本的 ProductVersion 属性.请注意,仅计算前 3 个数字.( 1.2.3 -> 1.2.4 有效 1.2.3.4 -> 1.2.3.5 无效 )

3) New MSI must have a higher version ProductVersion property. Please note that only the first 3 numbers are evaluated. ( 1.2.3 -> 1.2.4 works 1.2.3.4 -> 1.2.3.5 does not )

4) 旧 MSI 和新 MSI 必须安装在相同的上下文中(每用户->每用户或每台机器->每台机器)

4) Old MSI and New MSI must be installed in the same context ( Per User->Per User or Per Machine -> Per Machine )

5) 必须正确编写升级表.使用 MajorUpgrade 元素来帮助实现这一点.

5) Upgrade Table must be authored correctly. Use the MajorUpgrade element to assist in this.

这篇关于使用 wix 安装较新版本的 msi 时从程序和功能中删除程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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