Windows Service uninstall

G

Guest

I've created a Windows Service in C# and an installer project for it.

I installed the service using the packaged installer project and the service
was installed correctly and it runs fine.

I've since made some changes to this service.
I then proceded to uninstall it (Add/Remove Programs) to install the new one.
However, the service still shows under Services, but the .exe is gone.

I can't install the new version of the service, because the installer says
that the service is already installed.

Someone please help me get this mess straightened out.

Thanks.
 
G

Guest

Possibly the initial uninstall failed due to "old" service still running.

Services show under CP's Windows Services when there are registry entries
for it still.

I'd try something like:

Make sure the old one isn't still running
Reinstall the old on top of the old
Uninstall the old
Reinstall the new

Worst case: Hunt down the registry entries for the service with regedit...

Services typically install and uninstall just fine...
 
G

Guest

That's just what I had to do.
I found the key in the registry and deleted it.
I had to reboot after that, but the service was gone and I was able to
reinstall the new version.

From now on, I'm just going to overwrite the .exe instead of reinstalling
the service.

Thanks for your help.
 
G

Guest

Another, more reliable fix is to right click on your installer project file
in .net. Notice the product code in the properties window? Click on the ...
button and then click New Code. It generates a new guid and when you rebuild
the project you'll be able to reinstall it. I often shag my installer by
making lots of changes but I forget to uninstall first. This has saved my a$$
on many occasions. Otherwise, spin through the registry and wipe out the
obvious. There is a tool Microsoft make available that cleans up the
installer environment (I forget it's name). I've had mixed fortunes with it
though.
 
G

Guest

Instead of using the Add/Remove programs, use the InstallUtils.exe. The /u
option is used to uninstall services. The InstallUtils.exe is a part of the
..NET Framework tool set, and it works great for installing/uninstalling
services. There are a ton of articles on the web on how to use it.
 

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

Top