当服务已被删除时,MSI 安装程序在卸载过程中失败 [英] MSI Installer fails during uninstall when serivce was already removed

查看:65
本文介绍了当服务已被删除时,MSI 安装程序在卸载过程中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些自定义操作的安装程序 &设计师想安装一个windows服务.

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

有时,当我在自定义操作(或 MSI 配置)中出错时,升级过程可能会失败.解决方案是卸载应用程序并重新安装.

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.

忘记提及:VS 2008,默认安装程序项目,没有花哨的东西,目标机器是 Windows XP

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

推荐答案

是的,这就是我说不要使用 VDPROJ 和 InstallUtil 自定义操作的众多原因之一.您需要在卸载自定义操作中放置一个 try catch 块并处理该情况.

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.

希望您正在 VM 上进行测试并且可以恢复,但如果这是您的开发箱,请使用 Windows SC 命令重新创建服务,以便您现在可以进行卸载.

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:

使用 Windows Installer XML 增强 InstallShield - Windows 服务

同样的概念也适用,您只需将 WiX 合并模块添加到 VDPROJ 安装程序即可.

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

这篇关于当服务已被删除时,MSI 安装程序在卸载过程中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆