Say, you have a custom Windows service installed on a server. The service is written using .NET, and it is installed using either InstallUtil, an MSI package or the ManagedInstallerClass (if it makes a difference, pick the one that solves the problem). Regularly, you will need to deploy changes to the service, and of course you want to make this as easy as possible.
Is it “safe” to just stop the service, replace the .exe file and restart the service? Or would you have to uninstall and reinstall with the new .exe file? Would it be easier if the “evolving” part of the service was split into a separate assembly? Are there any tools or APIs that might be of help in either development or deployment of the service?
For updating services we either use MSI packages (in case we provide an installer to our customers anyway) or a short script that handles stopping and uninstalling the old version of service, and then copies, installs and starts the new version.
For scripting the deployment of local services you can use standard Windows commands such as
net startandnet stopin combination withinstallutil, for remote deployment you could e.g. usepsexecuteandpsservicefrom SysInternals.