Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Component Id='c_WSService' Guid='*'>
- <File Id='f_WSService' Name='WSService.exe' Vital='yes' Source='..wssvrreleasewsservice.exe' />
- <ServiceInstall Id='WSService.exe' Name='WSService' DisplayName='[product name]' Type='ownProcess'
- Interactive='no' Start='auto' Vital='yes' ErrorControl='normal'
- Description='Provides local and remote access to [product name] search facilities.' />
- <ServiceControl Id='WSService.exe' Name='WSService' Start='install' Stop='both' Remove='uninstall' Wait='yes' />
- </Component>
- sc stop {name of your service}
- sc start {name of your service}
- '' This works. It leaves the MSI in a state that tells you to reboot the PC, but you really don't need to.
- Private Sub ProjectInstaller_BeforeInstall(sender As Object, e As System.Configuration.Install.InstallEventArgs) Handles Me.BeforeInstall
- Dim sEchoMessage As String = String.Empty
- sEchoMessage &= " & ECHO ****************** Please be patient *******************************"
- sEchoMessage &= " & ECHO Pausing to stop and delete the previous version of the following service:"
- sEchoMessage &= " & ECHO " & ServiceInstaller1.ServiceName
- sEchoMessage &= " & ECHO -------------------------------------------------------------------------------"
- sEchoMessage &= " & ECHO After install is complete, you may see a message that says you need to reboot."
- sEchoMessage &= " & ECHO You may IGNORE this message - The service will be installed and running."
- sEchoMessage &= " & ECHO There is NO Reboot required."
- sEchoMessage &= " & ECHO *******************************************************************************"
- RunCommandCom("sc stop " & ServiceInstaller1.ServiceName & " & sc delete " & ServiceInstaller1.ServiceName & sEchoMessage, 15000)
- End Sub
- Private Sub RunCommandCom(command As String, mSecSleepAfterExecution As Integer)
- Using p As Process = New Process()
- Dim pi As ProcessStartInfo = New ProcessStartInfo()
- pi.Arguments = " /K " + command
- pi.FileName = "cmd.exe"
- p.StartInfo = pi
- p.Start()
- System.Threading.Thread.Sleep(mSecSleepAfterExecution)
- p.CloseMainWindow()
- End Using
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement