Hi,

We're currently experimenting with various upgrade strategies.  So far
I like the simplicity of the "Major Upgrade" only approach.

One option we're looking at is that due to the potential for database
changes, e.g. db schema changes and data conversion scripts, we don't
want the installer to allow upgrades for anything older than the
previous release version.

For example: 1.1 -> 1.2 is ok, but 1.0 -> 1.2 is not; you should
upgrade 1.0 -> 1.1 then 1.1 to 1.2.

Has anyone else tried this approach?  Or is there a better method available?

I've seen examples of preventing downgrades, but couldn't find one to
do the above, so I created one by modifying the code from:
http://blogs.technet.com/alexshev/archive/2008/02/15/from-msi-to-wix-part-8-major-upgrade.aspx

Here's the code, initial tests seem okay, comments welcome.

<Upgrade Id="$(var.UpgradeCode)">
  <UpgradeVersion Minimum="$(var.ProductVersion)"
                  IncludeMinimum="no"
                  OnlyDetect="yes"
                  Language="$(var.ProductLanguage)"
                  Property="NEWPRODUCTFOUND" />
  <UpgradeVersion Maximum="$(var.PreviousProductVersion)"
                  IncludeMaximum="no"
                  OnlyDetect="yes"
                  Language="$(var.ProductLanguage)"
                  Property="OLDPRODUCTFOUND" />
</Upgrade>

<!-- Prevent downgrading -->
<CustomAction Id="PreventDowngrading"
              Error="Newer version already installed." />
<!-- Prevent old versions upgrading -->
<CustomAction Id="PreventOldVersionUpgrading"
              Error="An older version is installed. Upgrade this
version first." />

<!-- Sequences -->
<InstallExecuteSequence>
  <Custom Action="PreventDowngrading"
          After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <Custom Action="PreventOldVersionUpgrading"
          After="FindRelatedProducts">OLDPRODUCTFOUND</Custom>
  <RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>

<InstallUISequence>
  <Custom Action="PreventDowngrading"
          After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <Custom Action="PreventOldVersionUpgrading"
          After="FindRelatedProducts">OLDPRODUCTFOUND</Custom>
</InstallUISequence>

-- 
It's a wild world that we live in, you step to the vibe like a new
found religion, take your position, compile your vision, futurism,
algorithm has risen up!                                pfm - the western

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to