Installing a service through code.

  • Thread starter Thread starter UJ
  • Start date Start date
U

UJ

I have a situation where I want to upgrade/add a service on a machine
automatically. If the service is already there, I need to remove it. I then
need to install a new version of the service. How do I go about this in
code?

TIA - Jeff.
 
Unless you want to take another approach, you would normailly write an MSI
Windows installer (Deployment Project) and set the "Remove Previous Versions"
property to true.
Your installer would also need to have some custom commands to stop and
uninstall the previous version, and install and start the new version. Some
study will be required, there are a few articles out there that will help.
Peter
 
Thanks Peter. But I need to have it done silently behind the scenes. A
program will figure out there's a new version and run without human
intervention.

Jeff.
 
Check this link out. I posted some code which I use to install
windows service programatically. You should be able to adapt it to
your purposes. I think it is in VB but should be fairly straight
forward to convert.

http://tinyurl.com/7382d
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top