tags:

views:

396

answers:

2

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?

+1  A: 

OK, I worked out that there is a trick that you can use to be able to detect uninstalls.

My version 1.1 WXS changed to:

        <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
            NOT NEWERVERSIONDETECTED OR REMOVE ~= "ALL"
        </Condition>

and in version 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>

So my LaunchConditions will never fire on Uninstall, and will correctly detect which version if any is being upgraded from.

Coxy
+1  A: 

I'm assuming that when you refer to a given version of your app, say "app 1.1", you're always talking about the same installable image. As opposed to multiple non-identical installable images (with different package codes, for instance), which just happen to share a product version number.

If that's the case, then you don't need to do anything to explicitly block the user from installing app 1.1, when app 1.1 is already installed. The installer service is going to recognize that app 1.1 is already installed, and it won't let you install it again. It's going to come up in maintenance mode. It thinks you want to add or remove feature, or maybe uninstall the product.

Ed

related questions