Update->Check if previous version exists

Got a problem you cannot solve? Try here.
Dalli
Posts: 13
Joined: Mon Jul 03, 2006 3:42 am
Location: Germany
Contact:

Update->Check if previous version exists

Postby Dalli » Fri Jul 18, 2008 5:25 am

Hello,
how could I check if the previuos version of my software exist? If there is no previous version the user should be informed by a dialog and then the application should finish. Is there an example for my setup?
Thanks for your help
Thomas
Regrads,

Dalli

Alex_Ronquillo
Site Admin
Posts: 364
Joined: Mon Jul 30, 2007 11:51 am
Location: USA
Contact:

Postby Alex_Ronquillo » Fri Jul 18, 2008 11:26 am

If your previous version was made with IA, IA automatically detects if there is a previous version installed and returns the result in NEEDSUPGRADE variable. Take a look at the Basic Setup template, which already includes code that detects and removes previous versions. If your previous version is not an IA installer, then:

You can use the "Is MSI Setup Installed" plug-in, if it returns FALSE, you can add a messagebox and a Terminate Installation commands. The script would look like this:

Code: Select all

Get Installed State for $TESTCODE$ into Variable ISInstalled
if Variable ISInstalled Equals FALSE
  MessageBox: Application Not Install, Application X is not installed
  Terminate Installation
end

Where $TESTCODE$ would be the product code of application.
Alejandro Ronquillo
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

andyhore
Posts: 20
Joined: Fri Jun 06, 2008 2:10 pm

Postby andyhore » Mon Jul 21, 2008 7:43 am

Hi,

I was just checking out this and, from what I can discover, this does not work :(

I create a version 1.0 of a setup and install it. I then create a version 1.0.1 (same Product code) and install that (I've got it set up to do an upgrade and it works just fine).

Now, if I run the 1.0 setup again, then NEEDSUPGRADE is set to TRUE, even though this is an older version of the product! Is that correct, or is it a bug? If it's correct, how can I solve my problem? I need to work out it's an oler version and not install.

Thanks,
Andy.

sjhein
Posts: 10
Joined: Wed May 09, 2007 11:13 am

Postby sjhein » Mon Jul 21, 2008 12:49 pm

Andy,

andyhore wrote:Now, if I run the 1.0 setup again, then NEEDSUPGRADE is set to TRUE, even though this is an older version of the product! Is that correct, or is it a bug? If it's correct, how can I solve my problem? I need to work out it's an oler version and not install.


This is the correct behavior. It allows you to "downgrade" to an older version of the software.

The way I do this is to add an MSICode script to the "Check Application Prerequisites" region. This script checks the version of the installed application EXE using "Get File Version" (I use Parse String to split the build number from the rest of the version string) and then terminates the installation if necessary.

Good luck,
-Scott


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 34 guests