Page 1 of 1
how to call the setup.exe of a previous installation
Posted: Thu Sep 27, 2007 4:15 am
by binkle
Hi,
as I need to run an exe-file before any uninstallation is performed I need to execute the previous installed setup.exe instead of calling “Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)” when a new version gets installed over an existing one.
Does anyone know how to call the setup.exe of a previous installation?
Greetings
Harry
Posted: Thu Sep 27, 2007 12:18 pm
by Alex_Ronquillo
This was my private answer for you:
Code: Select all
Run Program $EXEFILE$ /s MODIFY=FALSE REMOVE=TRUE REPAIR=FALSE (WAIT)
That should do it
Posted: Fri Sep 28, 2007 6:18 am
by binkle
This does not work.
Now there is an recursive endless loop.
The setup is calling itself.
For Testing I did as follows:
- Modified the IA code as you provided.
- Created "setup.exe” (single file)
- Renamed it to “1setup .exe” and installed it on a fresh Win-Server2003 (VMWare)
- Created another “setup.exe” (just pressed the button to created single file)
- Executing this new “setup.exe” on the server…
--> An endless loop, the setup is calling itself recursively,
the only way to stop it is to kill the first setup.exe file using the taskmanager
Any other Idea?
Greetings
Harry
Posted: Thu Oct 04, 2007 1:40 am
by binkle
Just to update this thread:
Alejandro wrote:
Actually, the EXE file you need to call is the one to uninstall the previous product and not the current product's EXE. It was in front of my eyes all the time, and couldn't see it. Runnin $EXEFILE$ inside an installation will always create an infinite loop. This is what you need to do, consider the following scenario and the steps taken, take the same steps for your case.
Let's say you have two version of 1 product:
Version 1: Revision code {743E5F53-CC62-46D3-9D9E-053B36A35480}
Version 2: Revision code {FAB3022E-48AA-461A-95C4-D6153608AE05}
You installed Version 1 one day. Some time later, Version 2 launches, and you want to substitute version 1 for version 2. When Version 1 is uninstalled, you want to run an EXE file via "Run Program" command, but the "(Un)Install MSI Package" command in Version 2 doesn't run the EXE file.
Since both versions have the same product code, Version 2 will check for the presence of Version 1 automatically, therefore the only code you need to change is (suppose the Version 1 exe file was setup.exe):
Replace the "(Un)Install MSI Package" command for the following code:
Code: Select all
Set Variable UNINSTALLEXE to {743E5F53-CC62-46D3-9D9E-053B36A35480}\\setup.exe
Comment: Getting Application Data folder for current user
Set Variable APPDATA to
Get Folder Location System->Application Data Directory into APPDATA
Comment: Getting Application Data folder for all users
Set Variable APPDATAALL to
Get Common Folder Location System->Application Data Directory into APPDATAALL
Set Variable EXISTS to
Comment: Checking for uninstall file in all users folder
Does File Exist $APPDATAALL$$UNINSTALLEXE$ (get result into variable EXISTS)
if Variable EXISTS Equals (Ignore Case) TRUE
Run Program $APPDATAALL$$UNINSTALLEXE$ /s MODIFY=FALSE REMOVE=TRUE REPAIR=FALSE (WAIT)
else
Comment: Checking for uninstall file in current user folder
Does File Exist $APPDATA$$UNINSTALLEXE$ (get result into variable EXISTS)
if Variable EXISTS Equals (Ignore Case) TRUE
Run Program $APPDATA$$UNINSTALLEXE$ /s MODIFY=FALSE REMOVE=TRUE REPAIR=FALSE (WAIT)
end
end
if Variable REMOVEOLD Equals -1
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
Posted: Thu Oct 04, 2007 1:42 am
by binkle
this looks good. But this is very static. Using this code I need to adjust the revision code on every release manually and it will not work if a user missed one release.
Is there a way to get the revision code of the current installed version automatically? (from the registry or so)
And what is if the setup.exe of the previous version does no longer exist?
I can't believe no one had this problem before.....
Posted: Fri Oct 05, 2007 5:12 am
by binkle
Alejandro wrote:
OK. Here's how you would check for the exe file for all versions, again assuming all products have the same product code:
Set Variable UNINSTALLEXE to
Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into UNINSTALLEXE
variable UNINSTALLEXE will conatin the file you would need to run. Your code would be now:
Code: Select all
Set Variable UNINSTALLEXE to
Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$PRODUCTCODE$\\UninstallString into UNINSTALLEXE Run Program $UNINSTALLEXE$ /s MODIFY=FALSE REMOVE=TRUE REPAIR=FALSE (WAIT) if Variable REMOVEOLD Equals -1
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-
Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
You are right, actually the code gets a lot shorter. Sorry I didn't think it this way before.
As you may see, UNINSTALLEXE file is the file to uninstall the previous application, if the application is installed, then the file MUST be there.
Posted: Fri Oct 05, 2007 5:15 am
by binkle
Great thing, that works fine!!
Greetings
Harry