我一直在玩Wix,用自动生成的安装程序制作一个小应用程序,用三个版本测试可升级性,1.0,1.1和2.0。
1.1意味着能够从1.0升级,而不允许用户在1.1已经存在的情况下安装1.1。
<Upgrade Id="MY_UPGRADECODE_GUID">
<UpgradeVersion Minimum="1.0.0"
IncludeMinimum="yes"
Maximum="1.0.0"
IncludeMaximum="yes"
Property="OLDERVERSIONBEINGUPGRADED" />
<UpgradeVersion Minimum="1.1.0"
IncludeMinimum="yes"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED" />
</Upgrade>
<Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
NOT (NEWERVERSIONDETECTED OR Installed)
</Condition>
问题#1:1.1无法卸载,因为在卸载过程中设置并检查了条件。
2.0意味着能够从1.1升级,而不是从1.0升级('太旧'。)它不应该能够自己安装。
<Upgrade Id="MY_UPGRADECODE_GUID">
<UpgradeVersion Minimum="1.1.0"
IncludeMinimum="yes"
Maximum="1.1.0"
IncludeMaximum="yes"
Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>
<Upgrade Id="MY_UPGRADECODE_GUID">
<UpgradeVersion Minimum="2.0.0"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED" />
</Upgrade>
<Upgrade Id="MY_UPGRADECODE_GUID">
<UpgradeVersion Minimum="1.0.0"
IncludeMinimum="yes"
Maximum="1.0.0"
IncludeMaximum="yes"
Property="TOOOLDVERSIONDETECTED" />
</Upgrade>
<Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
NOT NEWERVERSIONDETECTED OR Installed
</Condition>
<Condition Message="A version of [ProductName] that is already installed is too old to be upgraded. Setup will now exit.">
NOT TOOOLDVERSIONDETECTED
</Condition>
问题2:如果我尝试从1.1升级,我点击了修改后的版本条件。 (错误:已安装更高版本的主应用程序 1.1 。安装程序现在将退出。) 问题3:安装程序允许我在自己的顶部安装2.0。
我的升级代码和条件在我的MSI中出现这些问题我做错了什么?
答案 0 :(得分:3)
好的,我发现有一个技巧可以用来检测卸载。
我的1.1版WXS改为:
<Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
NOT NEWERVERSIONDETECTED OR REMOVE ~= "ALL"
</Condition>
和版本2.0:
<Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
NOT NEWERVERSIONDETECTED OR REMOVE ~= "ALL"
</Condition>
<Condition Message="A version of [ProductName] that is already installed is too old to be upgraded. Setup will now exit.">
OLDERVERSIONBEINGUPGRADED OR (NOT Installed AND NOT TOOOLDVERSIONDETECTED) OR REMOVE ~= "ALL"
</Condition>
所以我的LaunchConditions永远不会在Uninstall上启动,并且会正确检测哪个版本正在升级。
答案 1 :(得分:1)
我假设当你提到你的app的给定版本时,比如“app 1.1”,你总是在谈论相同的可安装图像。与多个不相同的可安装映像(例如,具有不同的包代码)相反,这恰好碰巧共享产品版本号。
如果是这种情况,那么当已安装app 1.1时,您无需执行任何操作来明确阻止用户安装app 1.1。安装程序服务将识别已安装app 1.1,并且不允许您再次安装它。它将出现在维护模式中。它认为您想要添加或删除功能,或者可能要卸载该产品。