471,317 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

Installing a service through code.

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.
Feb 21 '06 #1
5 1233
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
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.

Feb 21 '06 #2
UJ
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.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:06**********************************@microsof t.com...
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
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.

Feb 21 '06 #3
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

Feb 21 '06 #4
In that case, you will probably want to study the AppUpdater Application Block.
The basic concept is, a process will check a webservice periodically to see
if there is a new version. If so, it will silently download and install it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
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.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:06**********************************@microsof t.com...
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
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.


Feb 21 '06 #5
UJ
Well isn't that just a kick in the head. That's exactly what I was looking
for.

Thanks.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:BE**********************************@microsof t.com...
In that case, you will probably want to study the AppUpdater Application
Block.
The basic concept is, a process will check a webservice periodically to
see
if there is a new version. If so, it will silently download and install
it.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"UJ" wrote:
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.

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in
message
news:06**********************************@microsof t.com...
> 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
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "UJ" wrote:
>
>> 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.
>>
>>
>>


Feb 21 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Claire | last post: by
11 posts views Thread by tshad | last post: by
reply views Thread by Anonieko Ramos | last post: by
3 posts views Thread by Mukesh | last post: by
15 posts views Thread by =?Utf-8?B?RWxpb3Ro?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.