R – Can’t uninstall a service developed in Visual Studio

uninstallationvisual studiowindows-services

I have a Visual Studio project consisting of a service and an installer for it. During the development I have installed and uninstalled the msi-package at least fifty times but last time I tried to uninstall it I got an error message saying "the installed product does not match the installation source" and if I click "Ok" on that message i get the following: "The path xxxxxx.msi cannot be found." So, first it doesn't match and then cannot be found. Or something. The msi-package do exist on the path given in error message (I have replaced the real path and package name by xxxxx).

What I mean by installing the service is double clicking the msi-package that the "Build Solution" function creates and by uninstalling I mean Control Panel -> Add or Remove Programs.

I use Windows XP and Visual Studio 2003 in this particular project.

I have installed and uninstalled this and other visual studio developed services hundreds or thousands of times but have never had this problem before.

What should I do?

Best Answer

I've seen this happen before. Essentially the installer (.msi) windows wants to use is not available where it believes it should be stored. Why this happens I'm not entirely sure but to fix it you have a couple of options.

  1. Put your MSI in the place where windows is looking for it
  2. Forcefully remove your product entry from the MSI catalog using MsiZap. This option is a bit riskier since it's deleting all references to your service vs actually uninstalling it. However the risk is low if it's a service you've developed and it's just your dev machine.