I see quite a few people that lsit some kind of problem when they extend the basic ServiceInstaller that VS2005 will add to a service type project.

I want to be able to set the Recovery options but the basic Service Installer does not allow this, so I have extended it with reference to http://www.codeproject.com/install/sercviceinstallerext.asp(yes, sercvice is a typo in the url) but this code is for VS2003. The name and description properties can now be set for the service, so I have removed them from the extended class. I have set recovery options and gone as far as to make them into properties so that I can visually design all the aspects that I want to set when installing the service.

The hooking into the install process comes with:

// Register the event handlers for post install operations

base.Committed += new InstallEventHandler( this.UpdateServiceConfig );

base.Committed += new InstallEventHandler( this.StartIfNeeded );

The problem I have is that when the MSI containing this service is installed, even on a blank, fresh machine that has never had this service before, the message "The specified service already exists" is seen

I believe that the custom install routines are being called multiple times during install(?) but I havent so far been able to easily investigate. Can someone here explain how I could go about investigating this?

As an idea, I decided to try setting the Install and Commit custom actions to have a condition Not Installed but that did not work. Then I detached the event handlers so that effectively my custom installer does nothing (overrides nothing) and it still gives the error. In frustration i shelled out the ENTIRE class by commenting it all out leaving just:

public class ServiceInstallerEx: ServiceInstaller { }

And it still fails (after commenting out all relevant lines in InitializeComponent of ProjectInstaller.Designer.cs

I think i'm going nuts.. what IS this thing trying to do?

Update: I have replaced my extended installer with the standard one, and installation now succeeds.. Given that the extendedinheritedversion contains nothing new (it literally is just an empty class file, no code at all as per above) why does it not work, whereas the basic one does?