Connecting Tech Pros Worldwide Help | Site Map

Programatically uninstall/install a service.

UJ
Guest
 
Posts: n/a
#1: Jan 30 '07
How could I have a program uninstall a service and then install a newer
version of the same service? This assumes I've already got the files in the
appropriate directory to be able to install the new version of the service.

TIA - Jeff.


sloan
Guest
 
Posts: n/a
#2: Jan 30 '07

re: Programatically uninstall/install a service.



Check this:
http://www.eggheadcafe.com/articles/20041204.asp

Peter has a cool way to do it, you can probably pull the code from there.

...

The aritcle is about msmq , but in the code is the windows service
installer/uninstaller.



"UJ" <fred@nowhere.comwrote in message
news:%23ZdQAIJRHHA.1180@TK2MSFTNGP05.phx.gbl...
Quote:
How could I have a program uninstall a service and then install a newer
version of the same service? This assumes I've already got the files in
the
Quote:
appropriate directory to be able to install the new version of the
service.
Quote:
>
TIA - Jeff.
>
>

Ignacio Machin \( .NET/ C# MVP \)
Guest
 
Posts: n/a
#3: Jan 30 '07

re: Programatically uninstall/install a service.


Hi,


"UJ" <fred@nowhere.comwrote in message
news:%23ZdQAIJRHHA.1180@TK2MSFTNGP05.phx.gbl...
| How could I have a program uninstall a service and then install a newer
| version of the same service? This assumes I've already got the files in
the
| appropriate directory to be able to install the new version of the
service.

There is an option tin the setup project template where you can check for a
previous version and just install the new over it. Did you try it?


--
Ignacio Machin
machin AT laceupsolutions com


UJ
Guest
 
Posts: n/a
#4: Jan 31 '07

re: Programatically uninstall/install a service.


Thanks but I need to do it programmatically. I have a program that is going
to check for updates on our server and if there is a newer version it will
download it, uninstall the current service and replace it with the new one.

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%23WgjMrKRHHA.1908@TK2MSFTNGP05.phx.gbl...
Quote:
Hi,
>
>
"UJ" <fred@nowhere.comwrote in message
news:%23ZdQAIJRHHA.1180@TK2MSFTNGP05.phx.gbl...
| How could I have a program uninstall a service and then install a newer
| version of the same service? This assumes I've already got the files in
the
| appropriate directory to be able to install the new version of the
service.
>
There is an option tin the setup project template where you can check for
a
previous version and just install the new over it. Did you try it?
>
>
--
Ignacio Machin
machin AT laceupsolutions com
>
>

Ignacio Machin \( .NET/ C# MVP \)
Guest
 
Posts: n/a
#5: Jan 31 '07

re: Programatically uninstall/install a service.


Hi,

"UJ" <fred@nowhere.comwrote in message
news:OJL73oTRHHA.3996@TK2MSFTNGP04.phx.gbl...
| Thanks but I need to do it programmatically. I have a program that is
going
| to check for updates on our server and if there is a newer version it will
| download it, uninstall the current service and replace it with the new
one.

I know there is a way of doing that in code, just that I do not know it,
take a look in the archives.

A workaround would be:
1- stop the service
2- copy the new files over the old one
3- restart the service


All the above actions are easily implemented in code


--
Ignacio Machin
machin AT laceupsolutions com


Closed Thread


Similar C# / C Sharp bytes