Windows Service Installer
I happen to create a windows service and its installer in VS 2005 using .Net. The service is pretty simple to implement and the installer as well. The thing that matters is that if we just add the service to the installer and installs it, the service will be installed on the machine but it would not be registered with SCM. In order to auto-register it with SCM what we need is to include two custom actions for Install and UnInstall.
The above is depicted in the following figures:
Installation custom action
Go to custom action, add a custom action for Install and select service primary output with the argument “/install” as shown in the figure below:
UnInstallation custom action
Go to custom action, add a custom action for UnInstall and select service primary output with the argument “/uninstall” as shown in the figure below:
Now when you will un-install, the service will be un-registered as well. A word of caution is that “before un-installing, stop your service. Otherwise it remains in your service manager and vanished once you restart or log-off from your machine”.

Recent Discussions