我想在安装更高版本的MSI之前/之前删除/卸载预安装的较低版本MSI . 我的产品代码始终是唯一的,升级代码始终相同 .
(我不想允许降级安装 . )
但是当我安装更高的产品版本MSI时,它会被安装,但新安装和以前安装的MSI的添加/删除程序条目仍然存在 . 如何克服这个问题?以下是我的代码
<Product Id="*" Name="MyApp" Language="1033" Version="1.11.1111" UpgradeCode="00000000-8030-4B76-8F3A-8B8BB1000000">
<Package InstallerVersion="200" Compressed="yes" Platform="x86" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." AllowDowngrades="no" Schedule="afterInstallInitialize"/>
<Upgrade Id="{00000000-8030-4B76-8F3A-8B8BB1000000}">
<UpgradeVersion OnlyDetect="no" Maximum="99.0.0.0" Property="PREVIOUSVERSIONSINSTALLED" IncludeMaximum="no"/>
<UpgradeVersion OnlyDetect="yes" Minimum="1.0.0.0" Property="NEWERPRODUCTFOUND" IncludeMinimum="no"/>
</Upgrade>
1 回答
从这个可以看出:
http://www.joyofsetup.com/2010/01/16/major-upgrades-now-easier-than-ever/
MajorUpgrade元素替换Upgrade元素 . 您已经指定了两种升级类型,因此可能会导致一些问题 .
如果版本在前三个字段中递增,则UpgradeCode相同且ProductCode是新的,那么最可能导致失败的原因(并且安装了两个条目)是前一个是perUser(或perMachine)和您的升级是相反的 . 主要升级必须在相同的背景下 .