By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,161 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,161 IT Pros & Developers. It's quick & easy.

Programatically uninstall/install a service.

P: n/a
UJ
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.
Jan 30 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a

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" <fr**@nowhere.comwrote in message
news:%2****************@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.
>
TIA - Jeff.


Jan 30 '07 #2

P: n/a
Hi,
"UJ" <fr**@nowhere.comwrote in message
news:%2****************@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
Jan 30 '07 #3

P: n/a
UJ
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:%2****************@TK2MSFTNGP05.phx.gbl...
Hi,
"UJ" <fr**@nowhere.comwrote in message
news:%2****************@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


Jan 31 '07 #4

P: n/a
Hi,

"UJ" <fr**@nowhere.comwrote in message
news:OJ**************@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
Jan 31 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.