Detect an Uninstall in a Launch Condition using Wix MSIs

Posted by coxymla on Stack Overflow See other posts from Stack Overflow or by coxymla
Published on 2010-03-10T02:59:46Z Indexed on 2010/03/11 21:44 UTC
Read the original article Hit count: 739

Filed under:
|
|

I've been playing around with Wix, making a little app with auto-generated installer and three versions to test the upgradability, 1.0, 1.1 and 2.0.

1.1 is meant to be able to upgrade from 1.0, and not to allow the user to install 1.1 if 1.1 is already present.

        <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07">
            <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>

Problem #1: 1.1 can't be uninstalled, because the condition is set and checked during the uninstall.

2.0 is meant to be able to upgrade from 1.1, and not to upgrade from 1.0 ('too old'.) It shouldn't be able to install on top of itself either.

    <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07">
        <UpgradeVersion Minimum="1.1.0"
        IncludeMinimum="yes"
        Maximum="1.1.0"
        IncludeMaximum="yes"
        Property="OLDERVERSIONBEINGUPGRADED" />
    </Upgrade>

    <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07">
        <UpgradeVersion Minimum="2.0.0"
        OnlyDetect="yes"
        Property="NEWERVERSIONDETECTED" />
    </Upgrade>

    <Upgrade Id="F30C4129-F14E-43ee-BD5E-03AA89AD8E07">
        <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>

Problem #2: If I try to upgrade from 1.1, I hit my modified later version condition. (Error: A later version of Main Application 1.1 is already installed. Setup will now exit.) Problem #3: The installer allows me to install 2.0 over the top of itself.

What am I doing wrong with my Upgrade code and conditions to get these problems in my MSIs?

© Stack Overflow or respective owner

Related posts about wix

Related posts about upgrade