Page 1 of 1

Perform Uninstallation is not called from Install/Remove MSI

Posted: Thu Sep 20, 2007 2:43 am
by binkle
Hi,
I need to execute a file before uninstallation starts so I put the run program statement in the Uninstall region:

Code: Select all

[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
  Comment: Uninstall product
  Comment: TO-DO: Insert any additional uninstall commands here
  Run Program $TARGETDIR$\\bin\\MyInstall.exe /uninstall (WAIT)
  Apply Uninstall (get result into variable SUCCESS)


This works fine when I uninstall my product.
But when I build a new setup and try to install the new one it calls

Code: Select all

Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)

Which seems to be fine but this does not call “[DEFINE REGION: Perform Uninstallation]” from above.

I also tried to put “Run Program $TARGETDIR$\\bin\\MyInstall.exe /uninstall (WAIT)” in front of “Install/Remove MSI Package…” like

Code: Select all

[DEFINE REGION: Install Application Pre-Requisites]
  …
  Display Dialog: progressprereq, use as progress dialog (non-modal)
  [compiler if Variable BUILDMODE not Equals PATCH]
  if Variable NEEDSUPGRADE Equals TRUE
    Set Variable REMOVEOLD to
    Set Variable ERROROLD to
    Run Program $TARGETDIR$\\bin\\MyInstall.exe /uninstall (WAIT)
    Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
  …


But my exe file is not executed.

How can I solve this?
Where do I need to put “Run Program $TARGETDIR$\\bin\\MyInstall.exe /uninstall (WAIT)” so that it is called either on Uninstall and on the automatic uninstall when installing a new version?

Greetings

Harry

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Wed Oct 19, 2016 5:13 pm
by rev23dev
I'm having the exact same issue only 9 years later ;)

I have my old IA setup. During the uninstallation is removes services, like so.

[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
Comment: Uninstall product
Set Variable PROGRESSTEXT to Uninstalling $TITLE$ Services. Please wait.
Run .NET Uninstaller Class $TARGETDIR$\Integration.exe
Run .NET Uninstaller Class $TARGETDIR$\Backup.exe
Run .NET Uninstaller Class $TARGETDIR$\Workflow.exe
Comment: TO-DO: Insert any additional uninstall commands here
Apply Uninstall (get result into variable SUCCESS)
Set Variable PROGRESS to 100
else
....
end

This works fine when uninstalled manually.

However with

Install/Remove MSI Package {ECD887EF-A1A7-4986-B177-8A0E99451968}[REMOVE=ALL] (get result into variable WASUNINSTALLED)
(Is IA checked) that portion is never called.

Is there a way to fix this? Why did no one reply to this 9 years ago?

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Thu Oct 20, 2016 8:48 am
by FrancescoT
Dear rev23dev,

of course that portion will be never called when not uninstalling manually!

So the answer is really simple, you need to repeat the same instructions before to execute the "Install/Remove MSI Package " statemet.

Hope this helps you.

Regards

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Thu Oct 20, 2016 8:52 am
by rev23dev
Thanks, that's what I am currently doing and its working.

Can you explain the "of course" though? Seemed pretty logical to me? That's the uninstall routine, why is it not called when uninstalling? I figured especially checking the "Is IA Package" it would know what to do ;)

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Thu Oct 20, 2016 9:58 am
by FrancescoT
Because that uninstall routine gets exclusively called when the uninstall request is directly issued by the package which is "Already" installed.
While the other one that uses the "Install/Remove MSI Package " statement, it's exclusively called by the package which is upgrading an existing installation of the same product... and in this case, the uninstall request gets handled by the MSI engine directly.

Hope this helps you.

Regards

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Fri Oct 21, 2016 1:57 pm
by rev23dev
Thanks for the explanation!

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Tue Oct 25, 2016 12:45 pm
by FrancescoT
:D

Re: Perform Uninstallation is not called from Install/Remove MSI

Posted: Tue Apr 11, 2017 1:51 am
by Steve
I've been searching for the answers that are somewhat hidden in this post and a few other posts. So I'll summarise them here for any other reader's benefit:

A) If a user goes to WIndow's Add/ Remove Programs interface and clicks 'Uninstall', then the code that gets executed in from within your InstallAware installation package is the section [DEFINE REGION: Perform Uninstallation]

B) If a user is in the process of running a newer InstallAware installation package than the existing/older InstallAware installation package already installed (that must share the same Upgrade Product Code of course), then the area of your InstallAware code that is executed can be found under
'if Variable NEEDSUPGRADE Equals TRUE'. Beware, 'Perform Uninstall' does not get executed during an upgrade, despite what your intuition might lead you to believe. Any easy mistake to make since the old software does in fact get removed (which most people would assume was in effect an uninstall).

C) to add to the confusion, keep in mind that any areas of your code that are displayed in the colour 'purple' are not executed in a linear manner. Stuff in purple only happens after the 'Apply' (Apply Install or Apply Uninstall or Apply Maintenance) command is executed. So don't expect to have things happen in the same order that you see them in your script. However, all other text colours happen in the order listed.
This can really mess you up with something like a WIndows Service. If you use InstallAware's 'Control Services' to install, uninstall, stop or start your service, those commands are written in purple and won't execute linearly. If you need then to not be 'purple' execute linearly, then then you might want to thing about using 'Run Program' to control your services (ex; 'net.exe stop servicename' or 'net.exe start servicename')