4

I have a windows service that is already installed on a server, and I have a new version of the executable and linked assemblies. The normal procedure I use for installation of a new version is:

  1. Stop the service
  2. Uninstall the service using InstallUtil /u
  3. Overwrite the service executable and linked assemblies with the new ones
  4. Install the service using InstallUtil
  5. Start the service

I'm wondering if I'm doing too much? Is there any problem with just doing the following:

  1. Stop the service
  2. Overwrite the service executable and linked assemblies with the new ones
  3. Start the service

I don't think that uninstalling/installing is necessary but couldn't find any formal confirmation.

John Bledsoe
  • 17,142
  • 5
  • 42
  • 59
  • 2
    The most *obvious* issue is that involves taking the system down; for that reason, I tend to use `AppDomain`s - the service can then be self-updating (executing the *actual* system somewhere writeable), with the exe just handling the process spin-up and app-domain management; zero downtime to update – Marc Gravell Feb 03 '12 at 16:46
  • 2
    @MarcGravell That's an excellent idea and sounds pretty reusable. I haven't done much programming with AppDomains so is there a skeleton or template or blog post you could point me to that would get me started? – John Bledsoe Feb 03 '12 at 18:03

1 Answers1

4

If the service has already been installed, yes, you can xcopy deploy your new executable and assemblies without any problems.

All installutil is doing is creating the appropriate registry entries that point to the service executable. If you've previously ran installutil to create those entries, then there is no need to repeat this step when you change out the executable.

Cocowalla
  • 13,822
  • 6
  • 66
  • 112
  • Your answer is a bit misleading. Or rather, you are answering the question in the title ("Can I XCOPY" -> yes), but the last question he asks is "Is there any problem with just doing the following" to which the answer is **no** :-) – Daniel Hilgarth Feb 03 '12 at 16:39