How to update a Windows Service
-
Perhaps this should be in the general .NET forum, but what the heck. I've written a program, in C#, that runs as a service. I have done the installer so it will install the service on the system. However what I cannot figure out (and probably because paying for all this Microsoft software made me so broke I cannot afford the approriate book) is how to handle the case where the service is already installed when setup is being run. The installer will just say "Service is already installed" and rollback the entire installation. What I want to achive is that the executable for the service is updated and the service restarted. I figured maybe I could do a check to see if the service was installed, stop it and then delete it, before the installer installs the new version,but I can't seem to find a method to actually remove a service from the system either. Any pointers would be highly appreciated. /CMH
-
Perhaps this should be in the general .NET forum, but what the heck. I've written a program, in C#, that runs as a service. I have done the installer so it will install the service on the system. However what I cannot figure out (and probably because paying for all this Microsoft software made me so broke I cannot afford the approriate book) is how to handle the case where the service is already installed when setup is being run. The installer will just say "Service is already installed" and rollback the entire installation. What I want to achive is that the executable for the service is updated and the service restarted. I figured maybe I could do a check to see if the service was installed, stop it and then delete it, before the installer installs the new version,but I can't seem to find a method to actually remove a service from the system either. Any pointers would be highly appreciated. /CMH
This utility[^] helps you stop/uninstall/install/start any windows service. So you don't even need to create a service installer project with .NET. ;) Good luck. Click here to see my articles and software tools