How to update an installed Windows service?
You should uninstall the old windows service and install new version of windows service.
uninstall:
installutil /u yourproject.exe
install:
installutil yourproject.exe
You can check the path of installed service by opening services.msc from Run. Then right click your service and see the 'Path to executable'.
If this points to your bin directory, then it will be updated every time you compile successfully.
If you want to update your Service automatically, you can use a framework such as Google Omaha. This is the technology which Google use to update Chrome. It works well with Services because it runs silently in the background, just like a Service. This article gives more information about using Omaha to auto-update a Service.
On the other hand, if you want to manually update your Service: If the Service's location has not changed and the name of its executable has not changed, you should not have to uninstall and reinstall it. You can simply stop the service with net stop
, update its executable with a new version, and start it again with net start
. This approach worked reliably for me for many months.