1

I have created an msi installer using a WiX Setup project. The installation works fine however, the binaries aren't removed upon uninstallation. I noticed that if I change the guids of all the binaries every time before building my project, the uninstallation works. But I can't just keep changing Guids every time. Is there any way to resolve this issue?

1 Answers1

2

Development & Testing: This often happens during development and testing. You could have something as simple as two versions of the MSI installed without realizing it (you might have changed the product name and forgotten the older instance), or there could be weird problems that have resulted from testing and debugging efforts that have messed up component reference counting on your box (or even bugs in the tool - though I have never seen that with WiX).

Components are reference counted. This means that if two different MSI files install them and only one is uninstalled (ref count = 1) the components will not be removed until the last MSI that reference them is also uninstalled (ref count = 0).

Clean Virtual: Due to the frequency of such problems, it is recommended to test your setups on a clean virtual that can be restored easily to a clean slate. In fact: check your MSI on a clean virtual right away to verify if files remain after uninstall. If uninstall works on the clean virtual, then the problem is almost certainly development and testing side effects and problems on your main box (you can also install on a normal computer which has never had the package installed before).

Cleanup: To get rid of duplicate installations on your main box, you can run this script and look through the list of installed MSI packages for "duplicates" of your own product (here is a simpler script doing roughly the same thing). As mentioned: keep in mind that your installations could have different product names. You might want to try to search for your upgrade code (it will usually be the same for both installations). You can then uninstall all instances using standard command lines (see link below for more on uninstall - you need the product code as listed in the export created by the above script). Quick uninstall sample using mock-up product GUIDs:

msiexec.exe /x {11111111-1111-1111-1111-11111111111X}
msiexec.exe /x {11111111-1111-1111-1111-11111111111Y}

Component Referencing: Here is an older answer which tries to explain some of the mysteries of MSI component referencing. There are good links in there to Rob Mensching's articles on the same issue. Please read it and pay attention to the "auto-guid" feature. Also feel free to point us at your WiX source so we can check if you have done something unexpected (it happens).


Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164