Page 1 of 1
Prevent Old version of installer to overwrite new one
Posted: Wed Oct 19, 2011 4:20 am
by marccastaneda
Hi,
Is there a fast way to detect if you are overwriting a newer version of your application? It seems installaware allows this.
Thanks
Marc
Re: Prevent Old version of installer to overwrite new one
Posted: Wed Oct 19, 2011 1:11 pm
by giaviv
Marc,
If you run an older installer and a newer version is installed, your user will be prompted to to remove the installed version.
This is because IA uses revision codes, and whenever this code is different, the older version would be removed.
You can modify the section that deals with previous version uninstallation in MSIcode and read the current version from the registry, and only remove the installed version if its older.
Re: Prevent Old version of installer to overwrite new one
Posted: Mon Oct 24, 2011 9:41 am
by Obliterator
I added a simple lookup for this scenario to our install logic.
Just add the following lines to the 'Check/Install Application Pre-Requisites' region near the beginning of your script.
Code: Select all
Comment: Determine 64bit mode
Set Variable ISWINDOWS64BIT to FALSE
Get System Setting Windows in 64 bit Mode into ISWINDOWS64BIT
Comment: Read existing version from registry (note on 64bit machines IA seems to store this in the wow section, hopefully will get fixed at some point in the future)
Set Variable EXISTINGVERSION to
Set Variable EXISTINGLOCATION to
if Variable ISWINDOWS64BIT Equals TRUE
Read Registry Key HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCTCODE$\DisplayVersion into EXISTINGVERSION
Read Registry Key HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCTCODE$\InstallLocation into EXISTINGLOCATION
else
Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCTCODE$\DisplayVersion into EXISTINGVERSION
Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCTCODE$\InstallLocation into EXISTINGLOCATION
end
Comment: Check we are not upgrading to an older version
if Variable EXISTINGVERSION Greater Than (Version) $VERSION$
MessageBox: $TITLE$ Setup, WARNING: A newer version of $TITLE$ is already installed on this computer. The version you are trying to install is out of date (older than the installed version).$NEWLINE$$NEWLINE$Already Installed: $EXISTINGVERSION$$NEWLINE$About To Install: $VERSION$$NEWLINE$$NEWLINE$Downgrading to an older version is possible, but not recommended. Your data may now be in a newer file format which the old version cannot understand.$NEWLINE$$NEWLINE$If you are experiencing a problem with the newer version, we recommend you contact support and obtain a hotfix or newer update which addresses your problem (rather than downgrading).$NEWLINE$$NEWLINE$If you still wish to downgrade, despite these warnings you may continue to do so. The existing (newer) installation will be uninstalled before installation continues.$NEWLINE$$NEWLINE$Continue with downgrade?
if Variable WIZARD Equals CANCEL
Terminate Installation
end
end