11

when I try to uninstall a windows service from the control panel, I am getting error "the installed product does not match the installation source(s), until a matching source is provided or the installed product and the source are synchronized, this action cannot be performed". actually I do have the original MSI file, but I modified some settings in the config file (where it is installed) after installation, so that might have caused it, how can I uninstall it now?

RKP
  • 5,285
  • 22
  • 70
  • 111

1 Answers1

31

The MSI you think is the original probably isn't really. It sounds like you got yourself in a situation where PackageCode ( GUID ) A is installed and now you have an MSI with PackageCode B.

Take the MSI you have and run the following command:

MsiExec.exe /I foo.msi REINSTALLMODE=voums REINSTALL=ALL

This will "recache" the MSI with the updated PackageCode. You should then be able to uninstall either through Add Remove Programs ( Programs and Features ) or with the command

MsiExec.exe /X foo.msi
Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • that worked like a charm, thanks a million. I got frustrated with this issue and was almost thinking of creating a new setup file with a new name for the windows service – RKP Jan 10 '11 at 16:27
  • 4
    BTW, now would be a great time for me to mention the perils of testing installers on your dev box. It's kind of like going to the rest room in your own back yard. I highly reccomend virtual machines with snapshots for your development and testing. I *NEVER* install my installs on my own machine until they've gone through a complete release cycle and vetted by QA. – Christopher Painter Jan 10 '11 at 16:53
  • Also it sounds like you have a problem with your installer needing to ResolveSource during the uninstall when it probably shouldn't need to. You don't mention how you created the installer so it's difficult to address this problem. – Christopher Painter Jan 10 '11 at 16:55
  • I created the setup file for my windows service using Visual studio 2008. followed the instructions as mentioned in this article http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx. I have always had issues uninstalling the services, sometimes the service does not uninstall properly from control panel (i.e. the package disappears from add/remove programs, but the service still exists in the console), so I have to use installutil command, sometimes even that doesn't work, it simply disables the service, then I end up rebooting the machine, it was never easy like a button click for me – RKP Jan 10 '11 at 17:26
  • Yeah, those procedures are all junk. I've cursed MSFT DevDiv for years on the antipattern they created. If I was you, I'd just throw it away and use Windows Installer XML instead. It will work much better. – Christopher Painter Jan 10 '11 at 17:35
  • how the Windows Installer Xml can be used to create setup packages? Is there an article on it? – RKP Jan 11 '11 at 10:50
  • 1
    For folks like me that couldn't solve the problem using the answer above, try this: https://stackoverflow.com/a/3516591/6080047 – janonimus Jan 19 '22 at 05:10