简体   繁体   中英

Conditional install/uninstall of Windows Service

Using VS2008 TFS I have created a setup application that installs two Window Services. The first service is always installed and uninstalled (and works fine--I'm using the installer class). The second service is optional. Depending a custom condition I set up determines whether the 2nd service is installed. If requested the install works fine (using the installer class also). However, I cannot get the service to uninstalled during the uninstall process. The service exe is deleted, but the uninstall fails to uninstall the service. I have set the Condition property on my assembly file (in the File System) and on all the custom actions associated with this assembly. I suspect it is the custom action on the uninstall that is incorrect. I am unable to remove the condition on the uninstall custom action--I get an error if I do (Unable to build custom action name because it uses a conditionally installed file.) I have tried other conditions but they too fail to uninstall the service.

To ensure my installer class is working okay, as a test, I removed all conditions and forced the 2nd service to install. The install and uninstalled worked fine in this case. Hope someone can help. Thanks in advance.

Perhaps you can add an additional check in your condition, so that it only evaluates to true if the product is installed. There is an Installed property that might give you what you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM