Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2005 -> 2008/10 Service Installer Project Upgrade issue

I've upgraded a [.vdproj MSI generator project built into VS2008] System.Configuration.Install.Installer with a ServiceProcessInstaller and a ServiceInstaller from Visual Studio 2005 to 2008. There are no customisations of consequence to the installer class (i.e., not trying to start or stop services or register children)

RemovePreviousVersions is set to true, and I'm changing the Version and ProductCode. This triggers an error during the install:

"error 1001: the specified service already exists"

Googling yields stuff (but not on SO until now):- Google for "The specified service already exists"
The most useful one I've seen to date is http://forums.msdn.microsoft.com/en-US/winformssetup/thread/b2d1bd22-8499-454e-9cec-1e42c03e2557/ however this doesn't answer the fundamental question:-

Given that the user can pick either:
a) an install location that's the same
or b) an install location that's different
what are the minimal code changes would one sensibly make to ensure that the old service gets uninstalled and the new one gets installed? Or is there something other than a code change required to resolve this for the basic scenario of upgrading v1.0.1 to v1.0.2 of the same service with the same name (i.e., signing)

(AIUI the strong naming only comes into play if one has a significant uninstall step in the old installer that you dont have in the new one.)

I generated a new installer in VS 2008 and it fares no better.

For now, my workaround is to stop updating the Version and ProductCode, forcing the user to manually uninstall when they are told they already have a version installed.

Addendum thanks to divo's probing: While the simplest hack that could possibly work is to say "if install step is called & its an upgrade, call the uninstall step for the service first", I'd like a proper officially blessed answer! (e.g., how does the simple hack cope when the service is being renamed during an upgrade?)

like image 673
Ruben Bartelink Avatar asked Dec 16 '08 10:12

Ruben Bartelink


People also ask

How do I stop Visual Studio installer from updating?

Disable updating of all extensions in Tools | Options | Environment | Extensions and Updates. Uninstall Visual Assist. Exit Visual Studio. Run the .exe installer of a version of Visual Assist you are qualified to run.

How do I fix Visual Studio installer has stopped working?

Please remove the folder: C:\Program Files (x86)\Microsoft Visual Studio\Installer. Then, re-download the bootstrapper file from the following Microsoft Site and run it as administrator.


2 Answers

This should answer your question

How do I eliminate "The specified service already exists" when I install new versions of my software?

like image 74
Ryan Avatar answered Nov 15 '22 23:11

Ryan


Does your service (setup) provide a custom action for uninstalling the service?

An upgrade means that the previously installed product get uninstalled before the new product gets installed. I think the reason for the error is that the old service cannot be removed.

If your service is written in .NET you might find this article useful: http://www.codeproject.com/KB/install/InstallService.aspx

like image 23
Dirk Vollmar Avatar answered Nov 16 '22 00:11

Dirk Vollmar