14

I am learning VS 2008 setup project to create install for our C# application. I made a mistake trying to delete the exe itself during the uninstall. Now I manually deleted the exe file but the entry still in Add Remove Program list. I try to install a fixed newer version but msi doesn't allow me to do so.

How can I remove the old version manually (i can use regedit, no problem)? I am using XP machine. thanks

EDIT: After I removed its subkey in that uninstall registry entry, I still cannot install my newer version.

alt text

abatishchev
  • 98,240
  • 88
  • 296
  • 433
5YrsLaterDBA
  • 33,370
  • 43
  • 136
  • 210

3 Answers3

17

If this is a proper small update / minor upgrade .msi file to fix an earlier version which couldn't uninstall, just install it with msiexec /i updated.msi REINSTALLMODE=vomus (and maybe also REINSTALL=ALL). The v of vomus will have Windows Installer replace the old package with the new, and then you can uninstall normally.

But of course all this is unnecessary these days with the ability to test on a virtual machine you can just revert...

Michael Urman
  • 15,737
  • 2
  • 28
  • 44
  • 2
    **THANK YOU**! I've been staring at the _dumbest_ error condition ever until now. "Product is installed, please uninstall first" to be followed by "only valid for installed products". Talk about infuriating. – rainabba Sep 17 '13 at 19:13
  • Absolute lifesaver. Just spent an hour trying to remove a badly installed msi. Lovely job. Thanks. – alundy Aug 04 '14 at 12:59
  • `msiexec /i updated.msi REINSTALLMODE=vomus` also worked for when I made a bad MSI (had an Uninstall custom action that always failed). After removing that failing custom action, rebuilt the MSI, I could run the above command to fix the situation. – ErrCode Apr 09 '18 at 11:34
  • THANK YOU for saving from my bad MSI. – Houcheng Dec 10 '19 at 09:17
16

Remove your install entry in registry here. You might need to find out the GUID from your setup project.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall OR
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

Check also DisplayName, it can be helpful when your product has defined friendly name.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
tonyjy
  • 1,359
  • 3
  • 12
  • 24
  • 4
    There is a tool from MS to help with this, see http://support.microsoft.com/kb/2438651/ – Richard Nov 01 '10 at 14:01
  • how to find the GUID from the setup project? i have orca. – 5YrsLaterDBA Nov 01 '10 at 14:03
  • Since searching via regedit can be tough when trying to match partial names/strings I would recommend Exporting part of the registry to a text file for searching there instead to find keys to edit. – Jose Leon Jul 03 '14 at 03:53
  • Thank you. This method is preferable as it fixes a totally broken MSI that would not work otherwise. – c00000fd Jan 19 '17 at 00:07
  • 3
    Additionally, remove the following key: `HKEY_CURRENT_USER\Software\Microsoft\Installer\Products\{}` if the installer doesn't need elevation. Otherwise use `HKLM` hive. – c00000fd Jan 19 '17 at 01:10
  • 1
    I also had to remove a key from `HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products` otherwise it continued telling me I had another version of the program installed when I tried to reinstall. – Daniel May 31 '17 at 21:40
10

Use msiexec /x {guid product code}. If your MSI database got screwed up and this doesn't work, try msizap.

Anton Tykhyy
  • 19,370
  • 5
  • 54
  • 56
  • Except that it didn't actually cleanly uninstall your application. Any components and resources are abandonded and subsequence installs will behave wierdly ( like never uninstall ) because MSI will think they are shared components. – Christopher Painter Nov 01 '10 at 21:31
  • If this happens (e.g. because the copy of your application's `.msi` cached by MSI got deleted), run `msizap` with the original `.msi` instead of the product code. – Anton Tykhyy Nov 01 '10 at 21:40
  • 6
    In the comments for msizap, it is suggested to instead use http://support.microsoft.com/mats/Program_Install_and_Uninstall, which worked for me. – umbyersw Jan 16 '12 at 18:38
  • +1 to umbyersw's comment. The program was easy to use, and it removed my entire installation including services. – sky-dev Aug 08 '12 at 18:49
  • @umbyersw Thanks - "Fix it" (in spite of its cheesy name) removed a troublesome Java installation for me. – Aasmund Eldhuset Aug 26 '13 at 20:33
  • [**Uninstall MSI files** (a plethora of options, recommend section 3)](https://stackoverflow.com/questions/450027/uninstalling-an-msi-file-from-the-command-line-without-using-msiexec/1055933#1055933). [**How to find the product code of an installed MSI**](https://stackoverflow.com/questions/29937568/how-can-i-find-the-product-guid-of-an-installed-msi-setup/29937569#29937569). – Stein Åsmul Mar 11 '19 at 17:16