Hi, I seen the articles of making a Windows Service and using InstallUtil and InstallUtil /u
But, how do I now take this one step further and put it into a deployment setup.exe, what I require is guidence to make a setup program to put on a distrubtion CD. I know how to do it for a basic install windows form, but for a Windows Service and shelling out to InstallUtil might be okay, but how do you do that ? or even what is the best way of getting this installed correctly and running quickly?
A typical Windows Service program that I have open. ( it is an exciting one!! )
Imports System.ServiceProcess
Public Class Service1
Inherits System.ServiceProcess.Serv
iceBase
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call
End Sub
'UserService overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' The main entry point for the process
<MTAThread()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.Serv
iceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.Serv
iceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.Serv
iceBase () {New Service1}
System.ServiceProcess.Serv
iceBase.Ru
n(Services
ToRun)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.ICon
tainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
<System.Diagnostics.Debugg
erStepThro
ugh()> Private Sub InitializeComponent()
components = New System.ComponentModel.Cont
ainer()
Me.ServiceName = "Service1"
End Sub
#End Region
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
MsgBox("Starting the service")
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
MsgBox("Stopping the service")
End Sub
End Class
Start Free Trial