Installing a new version doesn't properly remove the old

Got a problem you cannot solve? Try here.
Post Reply
alexander.heuts
Posts: 6
Joined: Sat Dec 20, 2008 12:57 pm
Contact:

Installing a new version doesn't properly remove the old

Post by alexander.heuts »

Hello,

We're using an InstallAware installer to install our product. If we run a new installer (product has been updated at that point) it needs to uninstall the old install. This works as expected, but we've got a small customization of our uninstall routine.

During the uninstall one of our own programs is run to verify user credentials and send some information to our servers. Based on the result of that program the uninstall is aborted or continued. This works properly if we uninstall the program with the normal uninstall shortcuts, but as soon as we run a new installer it doesn't run our program. This causes the uninstall to fail.

What's different between a normal uninstall and an uninstall triggered by a new install?

Any help would be appreciated.

Alexander
ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Post by ALive »

Hi, alexander!

I'm pretty sure for 99.99% that you've encountered the same issue as I am.

Maybe you notice how the Uninstall of the product happens when you're making Upgrade of you product. If you look inside MSI code you can see the usage of (Un)Install MSI. This command simply run something like: msiexec /x {PRODUCT_GUID}. So, in other words, removes everything that was done by MSI engine. But not the actions that you've done through so called custom actions like "Run Program" or something similar.

When you use Remove App by a Shortcut it actually run you Installer.exe with parameters REMOVE=TRUE MODIFY=FALSE which just execute your code (just navigate to Perform Uninstallation region block) where, of course, you take actions to revert the changes you've done after initial setup.

I guess you got my idea now. Just code Run Program (or Run Program As, whatever you like) the same way as inside Uninstall Shortcut does.

A small example of my usage:

Code: Select all

Set Localization Variable removePreviousVersion_ProgressText to Removing previous version of $TITLE$
 Set Variable PROGRESSTEXT to $removePreviousVersion_ProgressText$
 Set Variable PROGRESSMODE to MARQUEE
  
 Set Variable tempUninstallString to 
 Read Registry Key HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\$TITLE$\\ModifyPath into tempUninstallString
 WriteLog "$TITLE$ Uninstall String: tempUninstallString="$tempUninstallString$"" to $logFile$
  
 if Variable tempUninstallString Equals 
   MessageBox: $local_TitleSetup$, $commonLocal_RemovePreviousVersion_RegistryEntryNotFound$
   Terminate Installation
 end
  
 Set Variable uninstallExecutableExist to 
 Does File Exist $tempUninstallString$ (get result into variable uninstallExecutableExist)
 WriteLog "Uninstall executable Exist: uninstallExecutableExist=$uninstallExecutableExist$" to $logFile$
  
 if Variable uninstallExecutableExist not Equals TRUE
   MessageBox: $local_TitleSetup$, $commonLocal_RemovePreviousVersion_UninstallExecutableNotFound$
   Terminate Installation
 end
  
 Run Program $tempUninstallString$ /s REMOVE=TRUE MODIFY=FALSE (WAIT, get result into variable REMOVEOLD)
 WriteLog "Previous Version Uninstall (ProductID: $PRODUCTCODE$): REMOVEOLD=$REMOVEOLD$;" to $logFile$
  
 Set Variable PROGRESSMODE to 
Some time ago i've written about the issue with (Un) Install MSI Package function that it is not using executable itself with REMOVE=TRUE, like the Uninstall shortcut do. IA does not change this. So i decided to do uninstall this way.

If you got any questions, feel free to ask them.

Hope this helps!
alexander.heuts
Posts: 6
Joined: Sat Dec 20, 2008 12:57 pm
Contact:

Post by alexander.heuts »

Hi!

Thanks for the assist. You gave me a solution which far exceeded my actual requirement. :)

I now understand why it was behaving like it did. I could just prepend my required Run Program before the MSI uninstall occurs. Pretty simple fix, I just had to know where to look.
Post Reply