code_junkie

How can I determine that Windows Installer is performing an upgrade rather than a first time install?

Nov 11th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <!-- Property definitions -->
  2. <?define SkuName = "MyCoolApp"?>
  3. <?define ProductName="My Cool Application"?>
  4. <?define Manufacturer="Acme Inc."?>
  5. <?define Copyright="Copyright © Acme Inc. All rights reserved."?>
  6. <?define ProductVersion="1.1.0.0"?>
  7. <?define RTMProductVersion="1.0.0.0" ?>
  8. <?define UpgradeCode="{EF9D543D-9BDA-47F9-A6B4-D1845A2EBD49}"?>
  9. <?define ProductCode="{27EA5747-9CE3-3F83-96C3-B2F5212CD1A6}"?>
  10. <?define Language="1033"?>
  11. <?define CodePage="1252"?>
  12. <?define InstallerVersion="200"?>
  13.  
  14. <Upgrade Id="$(var.UpgradeCode)">
  15. <UpgradeVersion Minimum="$(var.ProductVersion)"
  16. IncludeMinimum="no"
  17. OnlyDetect="yes"
  18. Language="$(var.Language)"
  19. Property="NEWPRODUCTFOUND" />
  20.  
  21. <UpgradeVersion Minimum="$(var.RTMProductVersion)"
  22. IncludeMinimum="yes"
  23. Maximum="$(var.ProductVersion)"
  24. IgnoreRemoveFailure="no"
  25. IncludeMaximum="no"
  26. Language="$(var.Language)"
  27. Property="OLDIEFOUND" />
  28.  
  29. </Upgrade>
  30.  
  31. <!-- Define custom actions -->
  32. <CustomAction Id="ActivateProduct"
  33. Directory='MyCoolAppFolder'
  34. ExeCommand='"[MyCoolAppFolder]activateme.exe"'
  35. Return='asyncNoWait'
  36. Execute='deferred'/>
  37.  
  38. <CustomAction Id="NoUpgrade4U"
  39. Error="A newer version of MyCoolApp is already installed."/>
  40.  
  41. <InstallExecuteSequence>
  42. <Custom Action="NoUpgrade4U"
  43. After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  44. <Custom Action="ActivateProduct"
  45. OnExit='success'>NOT OLDIEFOUND</Custom>
  46. </InstallExecuteSequence>
Add Comment
Please, Sign In to add comment