My Wix installer worked installing my program, but it's broken for uninstallation. A file is removed too early, and it's needed further down the line. The uninstaller fails and reverts its changes.
This means I can't remove the package from my machine, and hence can't install any further builds of my installer (a considerable inconvenience). How can I force removal of the package?
Find your package in C:\Windows\Installer
, where Windows keeps copies of installed MSI packages. The names are generated randomly, so you'll have to look at the creation dates of the files.
Open the MSI file with Orca. (Unfortunately there is no simple download for the orca installer. You can get it by installing the "MSI Tools" of the Windows 10 SDK, and then searching for orca.msi in C:\Program Files (x86)\Windows Kits
.)
Delete the offending custom action from the CustomAction table
Now you should be able to uninstall the package.
edit: according to @darkrock76's answer below, the folder for step 1 could also be C:\ProgramData\Package Cache\
. I have both on my Windows 7 SP1 machine. I could not immediately find documentation about this.
UPDATE: Hi Wim, thanks for the good registration-free COM info you have provided earlier! A couple of updates on this uninstall issue: darkrock76s answer is incorrect, please see my comment to him below. Also, instead of deleting the custom action in your step 3 above, you could set its condition in the InstallExecuteSequence table to 0 (numeric zero == false) to prevent it from ever running. Deleting the custom action table entry leaves a few broken foreign key references (could fail at some point I guess). The Microsoft FixIt tool can also be tried before resorting to this hack. There are some alternative, free MSI tools / editors / viewers (towards bottom) in addition to Orca. Maybe the user should also make a zip of the original MSI before editing, but I guess that is implied. Please do delete this messy comment once you get it - I might write up a quick summary of different ways to force such uninstalls if I get the time (The FixIt MS Tool, using minor upgrades, edit the cached MSI directly, apply transform for the uninstall, and whatever else there is). Rock on with deployment :-). Your registration-free COM answer have helped me (Stein) quite a bit in the past. Many thanks.
And forgot one thing: you can find the actual cache MSI file using Powershell. That was for one package, you can also get for all packages (scroll down to first screenshot).
This command usually works for me:
msiexec /fv installer.msi
It somewhat recaches the installer, so you can try again with a corrected one.
One time this command didn't work and I had to use Microsoft FixIt. It solved the problem (quite a shock for me).
Depending on the exact reason of the behavior you described, you might have at least a couple of options.
If the reason of the failure is a custom action which runs on uninstall, and this custom action is conditioned with some properties you can influence upon, you can try to pass the desired value via the command line:
msiexec /x {YOUR-PRODUCTCODE-HERE} RUNMYACTION=false
In this sample RUNMYACTION
is a Windows Installer property which participates in a custom action condition, and if you pass false
as its value, the action won't run.
Otherwise, you can fix the logic (or just disable the custom action explicitly) and build the new MSI package. Then upload it to that target machine, and run like this:
msiexec /i YourPackage.msi REINSTALL=ALL REINSTALLMODE=vomus
Here YourPackage.msi
is a new fixed package, REINSTALL=ALL
instructs the msiexec
to re-install the product using this new package, and REINSTALLMODE=vomus
(the v
part of it) will re-cache the MSI package and you'll be able to remove it the normal way afterwards.
A side note: you should test your installation on a virtual machine in order not to risk your real one.
FYI: In Windows 8.1 the installers have been moved here: C:\ProgramData\Package Cache\
If you are really desperate and all solutions above don't work try
msizap.exe
This will erase all that your installer put on a machine
LITTLE WARNING
Don't run msizap without knowing what options you want to run it with (for a list of options run msizap /? first).
I usually just look for <Your Installer's Name>.msi
or <Your Installer's Company Name>
in the registry and delete some of the uninstall keys from some of the Products
under the Windows installer trees and everything usually works fine and dandy afterwards, although this WOULD leave some stuff lying around like cached installers and possibly tons of other registry keys for each file installed, etc. but its ALWAYS worked for me when developing installers because honestly, who cares if one MSI is left over and cached somewhere? You're using the machine for development anyways, right?
I used this little tool also from Microsoft
https://support.microsoft.com/en-us/help/17588/fix-problems-that-block-programs-from-being-installed-or-removed
Basically this tool can be used to "repair issues including corrupted registry keys that block you from installing or removing programs"
What it fixes:
Corrupted registry keys on 64-bit operating systems
Corrupted registry keys that control the update data
Problems that prevent new programs from being installed
Problems that prevent existing programs from being completely uninstalled or updated
Problems that block you from uninstalling a program through Add or Remove Programs (or Programs and Features) in Control Panel
It can be used for:
- Windows 7
- Windows 8
- Windows 8.1
- Windows 10