Windows Installer – Uninstall custom actions – WARNING!!!

With uninstall custom actions you have to be really careful.

#1 Rule

When working with uninstall custom actions, always encapsulate the custom action in a try / catch block!

Why?

If you are testing your uninstall process and it throws an exception you will be left with a half uninstalled application.
As the application has not un-installed you cannot install a new version and as the uninstaller is compiled you cannot rebuild the installer to fix the error that is causing the exception.

How do I know this?

I did this exact thing. I was creating an installer that had custom actions for both install and uninstall.
I caused an exception in the uninstall process and I was left with a product that could not be uninstalled!

Can you recover from this?

I found that in this scneario the Microsoft Fix-it tool is your saviour.

Download the fix it program from here, Microsoft Fix-it Uninstaller

Run the program and follow the prompts.

I did a custom uninstall, chose my product that had failed to uninstall and it cleans up all the relevant registry keys so that it has been completely removed from the computer.

Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.