LaunchExeWithDirectory custom action never runs exe during uninstall - Advanced Installer Community
davelampert
Posts: 1
Joined: Thu Dec 31, 2015 3:15 am

LaunchExeWithDirectory custom action never runs exe during uninstall

The installer successfully installs a Windows Service and a sys tray application in the APPDIR folder. However, the Windows Service later downloads and runs another application, Dynamic.exe, inside the same APPDIR folder so that if I try to uninstall, it won't be able to delete all the files in the APPDIR folder, since the uninstaller is unaware of the all things running in that folder.

Perhaps there's a way in Advanced Installer to automatically kill any process whose MainModule path is inside APPDIR. I assumed no, so I wrote a simple custom action (a LaunchExeWithDirectory) that I placed in the uninstall sequence right after Paths Resolution and before Preparing. It runs the Dynamic.exe with the command option -uninstall, and I've tested that manually and it kills all the other processes running in APPDIR and then exits itself. However, when I do the uninstall, it never runs that custom action. If I check "Fail installation if custom action returns an error", the uninstall will fail, and the event viewer will show:

Product: MyProduct -- Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: LaunchExeWithDirectory, location: C:\Program Files (x86)\MyProduct\MyProduct\, command: "Dynamic.exe" -uninstall

That's the correct location and name of the exe the custom action refers to, but it's simply not running. Could it be that it doesn't even try running this exe (even though the file exists) because it wasn't installed directly by the installer?

This is using Advanced Installer Professional 11.9 build 63002 and the test target machine was Windows 10 Home.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: LaunchExeWithDirectory custom action never runs exe during uninstall

Hi and welcome to Advanced Installer forums.

Sorry for the delayed reply.

In order to detect and stop a running process from an Advanced Installer package, you can use the Detect process and Terminate process predefined custom actions.

I'm not sure why your custom action fails. Can you send me the AIP (project file) to support at advancedinstaller dot com, so I can investigate it and see if it is configured correctly?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”