简体   繁体   English

MSI / Wix安装程序,安装或升级

[英]MSI / Wix installer, install or upgrade

I managed to create a MSI who can install or upgrade my product. 我设法创建了一个可以安装或升级我的产品的MSI。 But I want to go further and display messages like Your version is already up to date / An upper version is already installed . 但是我想走得更远,并显示类似“ 您的版本已经是最新 版本 / 已经安装了更高版本”的消息

In order to do this, I put this in my code : 为了做到这一点,我把它放在我的代码中:

<Upgrade Id="{{MYGUID}}">
    <UpgradeVersion Minimum = "0.0.0"
                    Maximum = "{{MY_CURRENT_VERSION}}
                    IncludeMinimum="Yes"
                    IncludeMaximum="No"
                    Property="UPGRADEOLDERVERSION"/>

    <UpgradeVersion Minimum = "{{MY_CURRENT_VERSION}}
                   OnlyDetect = "Yes"
                   IncludeMinimum = "Yes" 
                   Property="UPTODATE"/>

    <UpgradeVersion Minimum = "{{MY_CURRENT_VERSION}}"
                    Maximum = "99.99.99"
                    IncludeMinimum="No"
                    IncludeMaximum="No"
                    Property="UPPERVERSIONINSTALLED"/>
</Upgrade>

<Condition Message = "Already up to date">UPTODATE</Condition>
<Condition Message = "Upper version already installed">UPPERVERSIONINSTALLED</Condition>

And it works well. 而且效果很好。 But the thing is that I want the soft to be installed if it's not the case, and by adding theses Condition , whenever I try to install the software, the messages pop up and don't allow me to install the soft, unless I remove theses ones. 但事实是,如果不是这种情况,我希望安装该软件,并通过添加这些Condition ,每当我尝试安装该软件时,都会弹出消息,并且不允许我安装该软件,除非我删除了该软件这些。

The idea is to do something like 这个想法是做类似的事情

if(not installed) 
    # Apply the update rules
else
    install soft

How can I do this ? 我怎样才能做到这一点 ? Thanks ! 谢谢 !

Keep in mind that you can't install the same MSI twice, just in case that's what your "already up to date" message is about. 请记住,您不能两次安装相同的MSI,以防万一这是“已更新”消息的含义。 Anyway, you can't use properties derived from an upgrade as launch conditions because the fact of an upgrade (or not) does not get resolved until the FindRelatedProducts action has run, which is after launch conditions. 无论如何,您不能使用从升级派生的属性作为启动条件,因为在启动条件之后运行FindRelatedProducts操作之前,无法解决升级(或不升级)的事实。 So your properties have no value (=false) and prevent the install. 因此,您的属性没有值(= false)并阻止安装。

The short answer is that I think that if you use the WiX MajorUpgrade element it will do what you want, allowing upgrades but not downgrades. 简短的答案是,我认为如果您使用WiX MajorUpgrade元素,它将按您的意愿进行操作,允许升级但不能降级。 If you don't want to do that, then display your messages (or add them to a dialog) somewhere after FindRelatedProducts has run in the UI sequence. 如果您不想这样做,请在UI序列中运行FindRelatedProducts之后在某处显示消息(或将它们添加到对话框)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM