views:

51

answers:

2

consider a windows service with a setup project , now how can i force the windows service to start after it finish the Installation?

i tried to add project installer and in the commited even i started the service but that would only work if i used InstallUtil im looking for a way to make it while using the Setup Project...

any idea ?

+1  A: 

You could create a new custom action that would use the ServiceController class to start your newly created service.

Johann Blais
A: 

As Johann Blais suggested; First Add a deployment project & Add Custom Action in Both "Install" tab & "Commit" tab do what you require in these Tab, meaning start the service.

KhanZeeshan
do you mean making a new dll and attach it to custom action ? or exe file ? cause i tried with .bat and it didnt work !
Stacker
If you have done everything in OnStart function of Windows Service then just add the Primary Output from your Windows Service Project to the custom Actions.
KhanZeeshan
i already did that but then what this wont force tyhe service to start after installation
Stacker
http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx
KhanZeeshan
@Khan i already made the service did everything in that page , why your pointing me to that page ?
Stacker
i didn't know that, check this link; http://www.devnewsgroups.net/windowsforms/t15625-windows-service-autostart-problem.aspx
KhanZeeshan
actualy i guess this http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx will work im implementing it now
Stacker