Run custom action before files are removed by 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!

Mayoz
Posts: 3
Joined: Wed Sep 22, 2010 7:48 am

Run custom action before files are removed by uninstall

Hi,

I'm trying to unregister a dll using command line custom action. The problem is that when I'm uninstalling the files are being removed before the custom action is being processed. I can't figure out how to change the processing sequence.

I've tried to changed this at the Custom actions under "Custom Behavior", adding my attached custom action under UnpublishComponents action with the condition: "REMOVE=ALL" but this is breaks the installation.

Can someone tell me how to accomplish this?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Run custom action before files are removed by uninstall

Hello and welcome to Advanced Installer Forums,

Since you are new, I highly recommend you read our tutorials for a better understanding of how to use Advanced Installer to efficiently deploy your products.
This will also help you better understand support team's suggestions now and in the future. The simple and professional tutorials are especially important.

Regarding your issue, dlls registered during installation by Windows Installer should automatically be unregistered upon uninstall. That being said make sure your command line tool for unregistering dlls is returning 0 upon success. Otherwise, set your custom action to ignore the return code. Also, make sure you run your custom action with no impersonation if your tool requires admin privileges to do the unregistering.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Mayoz
Posts: 3
Joined: Wed Sep 22, 2010 7:48 am

Re: Run custom action before files are removed by uninstall

Hello Garbiel,

Thanks for your quick reply.
Maybe It's better if I explain my whole problem. I created an installation for a COM dll. Executing this installation gave me only registry entries for the application. I was missing "COM connection object" registry entry.
To resolve this I've created a custom registration tool(command line application) which just calls regsvr32 to register this COM dll. This works fine and I get all registry entries.

At an uninstall action I first tried to leave the unregistration process to Windows installer, but the registry entries weren't being cleaned up by Windows installer. So I decided to use the tool to unregister the dll. I added the tool to the uninstall custom action with condition REMOVE="ALL" set. Doing this I get the error "Failed loading dll" by regsvr32 as the tool is ran after the "Standard Remove Files action" and so the dll to be unregistered is already deleted.

In the tutorials I couldn't really find an example or explanation where/how I could change the sequence of execution.

Best regards,
Wilmaro
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Run custom action before files are removed by uninstall

Hello,
"Failed loading dll" by regsvr32 as the tool is ran after the "Standard Remove Files action" and so the dll to be unregistered is already deleted.
The UnpublishComponents standard action is normally before the RemoveFiles standard action. Since you said you placed it under UnpublishComponents that meant it ran before RemoveFiles. Standard action can be moved by right-clicking them and selecting Move After from the context menu. Custom actions can be moved by dragging them.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Mayoz
Posts: 3
Joined: Wed Sep 22, 2010 7:48 am

Re: Run custom action before files are removed by uninstall

Hello,

Maybe it's better if I send my aip file?

Best regards,

Mayoz

Return to “Common Problems”