I have a .NET application that installs a service using the custom installer/uninstaller.
This has been wrapped up into a Windows Installer, so that when it installs it registers the service, and when you deinstall it, it unregisters this service. But there are cases where the custom uninstaller can fail. (In my case, I had already manually uninstalled the service by calling installutil
.)
Now, when I attempt to uninstall the product via the windows installer framework, the following error comes up:
Error 1001. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. -> The specified service does not exist as an installed service.
This makes sense. Except that THEN, in spite of what the message said, the uninstallation is rolled back. (This problem is also described here).
I know that if I manually reinstalled the services the uninstalltion might work.
But I want to know if there's some way I can force this out of the list of installed products.
My current programmatic way of uninstalling this is to call
::MsiConfigureProduct(productCode.c_str(), INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT);
But this just has the same effect of uninstalling via the control panel, which fails.
What other approach can I take?