weston
weston

Reputation: 54801

Creating a service installer that reinstalls over the top

I have a service and a VS installer/setup project.

The installer installs/registers and uninstalls/unregisters the windows service fine.

In order to install without uninstalling I have RemovePreviousVersions set to True and I increment the version on the setup project properties and it prompts to also change the ProjectCode. All of this allows me to run the installer over the top of the previous one.

However during the install when it tries to register the service it complains that the service is already registered "Error 1001. The specified service already exists"

Should I test for this in my installer and not register the service again? This feels wrong because I expected it to uninstall the older version before installing the new version.

What bugs me is that when I right click the project and select "Install" from inside VS, it does all of this exactly correct without even having to increment versions etc.

Upvotes: 2

Views: 669

Answers (1)

Nikola Loncar
Nikola Loncar

Reputation: 2671

Try setting a condition in custom action - install in your setup project:

Not (Installed OR PREVIOUSVERSIONSINSTALLED)

You already have installed service in your system, you just need to update binary files.

Upvotes: 1

Related Questions