In this post I show you how to implement install or uninstall your application service, Without using installutil application.
Into your Service Project locate ProjectInstaller.vb file
And populate the Install and Uninstall funcotion as below
Public Overrides Sub Install(stateSaver As IDictionary) Me.ServiceProcessInstaller1.Account = ServiceAccount.LocalSystem Me.ServiceProcessInstaller1.Username = Nothing Me.ServiceProcessInstaller1.Password = Nothing Me.ServiceInstaller1.StartType = ServiceStartMode.Automatic Me.ServiceInstaller1.DelayedAutoStart = True Me.ServiceInstaller1.ServiceName = "In4MaticSystemsrv" Me.ServiceInstaller1.DisplayName = "In4MaticSystemsrv" Me.ServiceInstaller1.Description = "Your Description" MyBase.Install(stateSaver) End Sub Public Overrides Sub Uninstall(savedState As System.Collections.IDictionary) Me.ServiceProcessInstaller1.Account = ServiceAccount.LocalSystem Me.ServiceProcessInstaller1.Username = Nothing Me.ServiceProcessInstaller1.Password = Nothing Me.ServiceInstaller1.StartType = ServiceStartMode.Automatic MyBase.Uninstall(savedState) End Sub
Now, move into Setup Project Installer and locate Custom Action Editor
To access the Custom Actions Editor, on the View menu, point to Editor, and then click Custom Actions when a deployment project is selected in Solution Explorer.
right click on Custom Actions, add Custom Actions, into Application folder select your application service and click ok.
Compile application Setup and Install.
Now, your service is present into list of service locate in Services Control Manager
if you uninstall your application service from control panel Programs and Features then your application service will be removed automatically from the list of service