Imports System.ComponentModel Imports System.Configuration.Install Imports System.ServiceProcess Imports System.Configuration Imports System.Reflection Public Class ProjectInstaller Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() 'Add initialization code after the call to InitializeComponent Me.Installers.Add(GetServiceInstaller) Me.Installers.Add(GetServiceProcessInstaller) End Sub Private Function GetServiceProcessInstaller() As ServiceProcessInstaller Dim _installer As New ServiceProcessInstaller _installer.Account = ServiceAccount.LocalSystem Return _installer End Function Private Function GetServiceInstaller() As ServiceInstaller Dim _installer As New ServiceInstaller Dim _service As Assembly Dim _config As Configuration _service = Assembly.GetAssembly(GetType(SISService)) _config = ConfigurationManager.OpenExeConfiguration(_service.Location) _installer.ServiceName = _config.AppSettings.Settings("InstanceName").Value _installer.StartType = ServiceStartMode.Automatic Return _installer End Function End Class