Actually, I was able to do a web search and find a Very Old example of how
to handle upgrades which actually described what why each XML clause was
needed, and what it did.   To bad the so-called documentation doesn't do
that!

I'll show what I came up with for the Basic case, so far.

<Upgrade Id="$(var.BasicUpgradeCode)">
    <!-- Prevent downgrading to this older version.  Don't remove the
already-installed newer version of Basic. -->
    <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no"
OnlyDetect="yes" Property="NEWERBASIC" />
    <!-- Remove older versions of Basic -->
    <UpgradeVersion Maximum="$(var.ProductVersion)" IncludeMaximum="no"
OnlyDectect="no" Property="OLDERBASIC" />
    <!-- Windows Installer will install this version of Basic if it is not
already installed, or offer to Repair it if it is. -->
</Upgrade>

<Upgrade Id="$(var.LiteUpgradeCode)">
    <!-- Prevent downgrading to this older version.  Don't remove the
already-installed newer version of Lite. -->
    <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no"
OnlyDetect="yes" Property="NEWERLITE" />
    <!-- Remove older, or equal, versions of Lite -->
    <UpgradeVersion Maximum="$(var.ProductVersion)" IncludeMaximum=yes"
OnlyDetect="no" Property="OLDERLITE" />
</Upgrade>

<Upgrade Id="$(var.PremiumUpgradeCode">
    <!-- Prevent installing this Basic version if any version of Premium is
already installed -->
    <UpgradeVersion Minimum="0.0.0.0" IncludeMinimum="yes" OnlyDetect="yes"
Propery="PREMIUMFOUND" />
</Upgrade>


<CustomAction Id="NewerBasic" Error="A newer version of Basic is already
installed." />
<CustomAction Id="NewerLite" Error="A newer version of Lite is already
installed.  Download a newer version of Basic or Premium and try again." />
<CustomAction Id="PremiumFound" Error="Premium is installed.  Download and
install a newer version of Premium and try again." />

<InstallExecuteSequence>
    <Custom Action="NewerBasic"
After="FindRelatedProducts">NEWERBASC</Custom>
    <Custom Action="NewerLite"
After="FindRelatedProducts">NEWERLITE</Custom>
    <Custom Action="PremiumFound"
After="FindRelatedProducts">PREMIUMFOUND</Custom>
</InstallExecuteSequence>

<InstallUISequence>
    <Custom Action="NewerBasic"
After="FindRelatedProducts">NEWERBASC</Custom>
    <Custom Action="NewerLite"
After="FindRelatedProducts">NEWERLITE</Custom>
    <Custom Action="PremiumFound"
After="FindRelatedProducts">PREMIUMFOUND</Custom>
</InstallUISequence>



I'm not sure if I can eliminate the normal downgrade prevention for this
MSI and use the newer <MajorUpgrade> XML feature.  Probably, but I'll be
testing it.

I tried omitting the InstallUISequence section.  The installer worked, and
prevented/allowed/upgraded as it should, but the error messages came out
way later in the process.  By adding this section, they came out almost
immediately.  Sooner is better, so I'm leaving it in.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to