how to run custom action right during uninstall - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

alco
Posts: 80
Joined: Thu Nov 18, 2010 5:02 pm

how to run custom action right during uninstall

We have the following custom actions:

Code: Select all

1  Target Computer
2  - InstallUISequence
3  	- Begin
4  		- Kill_App.exe
5  		- App2.exe_unregister
6  		- App3.exe_UnregServer
7  - InstallExecuteSequence
8  	- Begin
9  		-UninstallPreviousVersions
10  	- Uninstall
11  	- Rollback
12  	- Install
13  		- App3.exe_RegServer
14  		- Welcome.html_1
15  	- Commit
16  		- Kill_updater.exe
17  		- App2.exe
18  		- App.exe
19  - UI Custom Actions
20  	- Welcome.html
During installation, installer should detect previous version and do custom actions under #3, then it removes previous version w/ #9. But, based on our tests, it seems everything in #3 is not getting done, as we have noticed the ff:

a. When installer starts and App.exe is running, installer asks to stop App.exe (with the Abort-Retry-Ignore dialog) w/c means installer was either unable to kill App.exe or #4 is not yet executed when the dialog appears.
b. #5 is supposed to show a command line window, but we do not see that at that point. We only see a command line window when #17 executes.

So my first question is how do we execute these custom actions before the previous version gets uninstalled?

Second question is when we try to uninstall from Add/Remove, how do we make everything in #3 run?

Note, all files in #3 are part of the package installed in the Program Files folder so they need to run before product is completely uninstalled (we have set application folder to be removed on uninstall regardless if empty of not).

PS: I already tried setting "REMOVE= ALL" on #5 and #6 but it didn't seem to have an effect as I still don't see command line window coming out.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run custom action right during uninstall

Hello and welcome to Advanced Installer Forums,
So my first question is how do we execute these custom actions before the previous version gets uninstalled?
You can simply place all your custom actions after the Begin( #8 ) standard action before the UninstallPreviousVersions( #9 ) custom action in the InstallExecuteSequence in the order you want them to be executed.
Second question is when we try to uninstall from Add/Remove, how do we make everything in #3 run?
Placing every custom action after the Begin( #8 ) standard action each with an execution condition set to:

Code: Select all

(REMOVE="ALL")
will do the trick.

If these answers don't help please send us the .AIP (project) to support at advancedinstaller dot com so we can investigate them.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alco
Posts: 80
Joined: Thu Nov 18, 2010 5:02 pm

Re: how to run custom action right during uninstall

Do these suggestions also take care of the scenario where the same installer is used to update existing installation on a PC, meaning everything in #3 will run?
alco
Posts: 80
Joined: Thu Nov 18, 2010 5:02 pm

Re: how to run custom action right during uninstall

I'm getting "Directory Manager not initialized" error when trying to uninstall.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run custom action right during uninstall

Hello,

Each custom action that has the execution condition set to

Code: Select all

REMOVE="ALL"
will run everytime the package will be uninstalled, whether it will be a simple uninstall or an uninstall done by a newer version package(package is upgraded).

To detect when the package is being upgraded you can use the UPGRADINGPRODUCTCODE property.
For example if you set the execution condition

Code: Select all

(REMOVE="ALL") AND UPGRADINGPRODUCTCODE
to a custom action, that custom action will run only when the package is uninstalled by an upgrade version.

To run a custom action when the package performs an upgrade you can use the OLDPRODUCTS property.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run custom action right during uninstall

Hello,
I'm getting "Directory Manager not initialized" error when trying to uninstall.
The directory manager is responsible for determining the target and source paths. It is initialized during the costing actions ( CostInitialize action, FileCost action, and CostFinalize action).
One of your custom actions made a call to a function requiring the directory manager before the initialization of the directory manager. The solution is to sequence this custom action after the costing actions.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alco
Posts: 80
Joined: Thu Nov 18, 2010 5:02 pm

Re: how to run custom action right during uninstall

mihai.petcu wrote: If these answers don't help please send us the .AIP (project) to support at advancedinstaller dot com so we can investigate them.
I already sent the aip files to support.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run custom action right during uninstall

Hello,

After looking into your AIP files this is what I found you need to do:
  • because the upgrade is done automatically by Windows Installer, remove the UninstallPreviousVersions(#9) custom action
  • share the #4, #5, #6 custom actions from the Begin(#3) standard action in the InstallUISequence to the Begin(#8) in the InstallExecuteSequence all of them with the execution condition set to:

    Code: Select all

    (REMOVE="ALL") OR OLDPRODUCTS
Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
alco
Posts: 80
Joined: Thu Nov 18, 2010 5:02 pm

Re: how to run custom action right during uninstall

Thanks! I applied your suggestion and it worked.

Return to “Common Problems”