MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: MDAC not too old?[Next]: Windows 2000 or Greater?
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Launch Conditions->Prevent Downgrades of Your Product

Launch Condition: Prevent Downgrades of Your Product

I normally treat upgrades (installing a newer version of an installed product) the same as downgrades (replacing with an older version), however some people don't want to allow this and at times there will be a good reason to prevent it.

The following code (based on code posted by Konstantin Malakhanov) will search for a newer version of your product and if so display an error message:

#define? MSG_NEWER_PRODUCT_INSTALLED The same or higher version of <$ProdInfo.ProductName> is already installed! Please uninstall this product first.
#(
    ;--- Look for any newer already installed version of this product -------
    <$ProductFind
        UpgradeCode="<$ProdInfo.Guid.UpgradeCode>"  ;;Must define in ".ver" file!
         VersionMin="<$ProductVersion>"             ;;Look for more recent versions than this one
           Property="NEWER_PRODUCT_INSTALLED"       ;;Define this property if we find a newer product.
          Inclusive="N"                             ;;Don't actually want to fail if same version (want maintenance dialogs)
            Message=""                              ;;Don't abort if not found!
    >
#)
#(
    ;--- Test for non-existance of property (INSTALL time only) ----------
    <$AbortIf
        Condition=^NEWER_PRODUCT_INSTALLED and (<$CONDITION_INSTALL_ONLY>)^
          Message=^<$MSG_NEWER_PRODUCT_INSTALLED>^
              Seq="FindRelatedProducts-"            ;;Must validate after product detection above!
         SeqTable="InstallExecuteSequence InstallUISequence"
    >
#)

The newer version must be manually uninstalled before the install of the older product can proceed.


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 7 Aug 2008Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: MDAC not too old?[Next]: Windows 2000 or Greater?


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Tuesday August 19 2008 at 7:04pm
Visit MAKEMSI's Home PageThis external link was OK when tested at 13 Aug 2008

HTML page dated Mon, 29 Jan 2007 00:11:11 GMT
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 7 Aug 2008