How to un-install a buggy msi that you created with wix

Today I had an issue with a wix based msi that I was developing. The msi was installing and starting up a TopShelf based service. However I forgot to add a condition to stop it trying to start the service when it was being removed and this was failing as the exe had been removed by the time it tried to start the service, doh!

This was a big problem as by default I do major upgrades that un-installs the old version before installing the new one.

With a little digging on the wix forums I managed to work it out. Basically you have to replace the msi that is cached in the C:\Windows\Installer folder with the new one that fixes the issue. To do this you need to make sure that the ProductId is the same and run the following msiexec command:

1
msiexec /fv [PathToYourInstaller]

This replaces the cached one with your fixed one which you will be able to uninstall.

If you don’t know the ProductId as you get wix to auto-generate it using ProductId=’*’ like I do, you will have to find the cached installer in the C:\Windows\Installer directory (I ordered by size and then found it by comparing the size). Then use InstaEdIt! or Orca to open up the msi and find the ProductId in the Properties table. Temporarily use this in the wix code create a new msi.