Petrus Theron
Petrus Theron

Reputation: 28837

Repair setup project throws Error 1001: "The specified service already exists"

The repair function for a setup project is basically a re-install, but because of my custom Install/Commit/Rollback/Uninstall action to manage a Windows service, my repair fails because the service already exists when the repair function is called.

The setup project should first remove the service before repairing it. I am already injecting custom actions via using System.Configuration.Install, so it should be possible.

How do I instruct the repair function to first remove the service?

Upvotes: 1

Views: 3392

Answers (1)

Hps
Hps

Reputation: 1177

if you are looking for a quick solution, then you can always delete the service manually in the custom action.

Create a new process to the call the "sc.exe" with the parameters as below:

sc.exe delete [service name]

of course, you will require some exception handling in here to check if the service already exists or not.

Upvotes: 3

Related Questions