I would like to modify an MSI installer (created through WiX) to delete an entire directory on uninstall.
I understand the RemoveFile
and RemoveFo
You can do this with a custom action. You can add a refrence to your custom action under
:
...
Installed AND NOT UPGRADINGPRODUCTCODE
Then you will also have to define your Action under
:
...
Where FileCleanerEXE is a binary (in my case a little c++ program that does the custom action) which is also defined under
:
...
The real trick to this is the Installed AND NOT UPGRADINGPRODUCTCODE
condition on the Custom Action, with out that your action will get run on every upgrade (since an upgrade is really an uninstall then reinstall). Which if you are deleting files is probably not want you want during upgrading.
On a side note: I recommend going through the trouble of using something like C++ program to do the action, instead of a batch script because of the power and control it provides -- and you can prevent the "cmd prompt" window from flashing while your installer runs.