views:

936

answers:

2

The Add/Remove Programs (or Programs and Features) Control Panel applet usually allows to uninstall or repair a program.

For a non-MSI installation it's easy to define what should happen, when a user clicks the "Change" or "Uninstall" button. Just set the appropriate keys in the Registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<AppName>).

My question is how to make the "Change", "Repair", and "Uninstall" buttons to work my way (e.g. to start a custom program) if an MSI-installation is used?

A: 

In MSI parlance that would be kicking off of a custom action (which can be a .EXE). Windows installer has a pretty steep learning curve... and generally trying to make it "work my way" is a short cut to lots of frustration.

If you're headed down this route you should look into Wix.sourceforge.net. Its got a very active user community that is deeply knowledgeable about windows installer.

+2  A: 

If you're using an MSI, do it the MSI way.

If you want to do something different, then don't use an MSI. You'll give yourself many, many headaches and lose the benefits of using MSI in the first place.

If you need to run your own EXE during uninstall, see my answer to this question and simply just negate the conditions.

One thing you have to remember with an MSI installation is that the user interface is optional, you can't count on it being displayed either during install or uninstall. A user might remove an application with MSIEXEC /X rather than clicking a button in ARP

If you really want to "do it your way" then I'd suggest creating a bootstrapper for the MSI, having the MSI install hide itself from Add/Remove Programs, and then manually add an ARP entry for your custom installer using the registry keys you have specified above.

sascha