Trick for setup developers - how to remove a setup package with a known uninstall bug

I was recently working on developing an MSI-based setup package as a learning exercise to teach myself some of the fundamental concepts of Windows Installer XML (WiX). During this process, I created a test MSI package and tried to install it on my development machine. Then, when I tried to uninstall it, I found that one of my launch conditions was being triggered incorrectly, which blocked me from being able to uninstall the package.

It was relatively simple to figure out why the launch condition was incorrect and fix it in my MSI package - I needed to schedule the AppSearch action to occur before LaunchConditions (since one of my launch conditions needed to use the results of one of my app searches) and also condition my AppSearch so it would happen in repair/uninstall cases and not only during initial install. However, I was stuck with the buggy version of the MSI installed on my development machine and blocked from uninstalling it.

I found a couple of options that allowed me to fix my development machine and work around the buggy uninstall logic that I had introduced and I wanted to share them here in case they are useful to any other setup developers reading this:

  1. Forcibly install a fixed version of the MSI - for this option, I took my newly fixed MSI that no longer had the uninstall bug and ran the following Windows Installer command line to force it to be installed over the top of the buggy one that was stuck on my system: msiexec.exe /fvecmus my_product.msi. This command line forcibly replaced the old installation with the new one by running from the source MSI and recaching the copy of the MSI in %windir%\installer. This removed the bug that blocked uninstall, and after that I was able to launch uninstall from Add/Remove Programs and everything worked as expected for me.
  2. Manually edit the cached MSI - for this option, I found the locally cached copy of the MSI in %windir%\installer (by looking at timestamps and finding the most recently created file in that folder), opened it in the Orca MSI editing tool, and then manually removed the entries from the LaunchCondition table that were blocking uninstall from running. This option can be used to fix simple errors, but complex errors will likely be difficult to manually fix in an MSI editor such as Orca.