MSI Installer fails during uninstall when serivce

2019-07-28 03:16发布

I've an Installer with some custom actions & the designer fancy to install a windows service.

From times to times, when I made a mistake in my custom actions (or in the MSI configuration) the upgrade process may fail. Solution is to uninstall the Application and do a fresh installation.

But sometimes I'm ending in the situation, where I can't uninstall the Application because the "custom actions" for the service claims, that the service is not registered in the system. OK, maybe, no problem. I'm uninstalling the App. The problem: my app don't get uninstalled. It remains. I have to manually add the service to the registry again and restart the uninstall process.

Question: What do I have to configure/develop/program/etc. to tell the service (un)installer not to fail during uninstall when the service is already removed.

BTW: My custom actions do NOTHING during uninstallation. Only during installation/upgrade, I'm asking the user for some configuration and do some custom config stuff - only related to my app. Not related to the service.

EDIT: forgot to mention: VS 2008, default installer project, no fancy stuff, target machine is Windows XP

1条回答
狗以群分
2楼-- · 2019-07-28 03:38

Yeah, that's one of the many reasons I say not to use VDPROJ and InstallUtil custom actions. You need to put a try catch block in your uninstall custom action and handle that scenario.

Hopefully you are testing on a VM and can just revert but in case this is your dev box use the Windows SC command to recreate the service so you can get the uninstall to work for now.

If you really want to do this right, you want to do something like this:

Augmenting InstallShield using Windows Installer XML - Windows Services

The same concept applies you'll just be adding the WiX merge module to your VDPROJ installer.

查看更多
登录 后发表回答