You have to create a class that inherits from
System.Configuration.Install.Installer - it can be in the same project as the
NT Service that you are installing.
Then you override then Install method and execute the service stopping code
in there, before calling the base Install implementation.
Something like this:
[RunInstaller(true)]
public class ProjectInstaller : Installer
{
public override void Install(IDictionary stateSaver)
{
// stop the service here
ServiceController ....
// now let the installer do its job
base.Install(stateSaver);
}
}
Cheers,
_____________
Adam Bieganski
http://godevelop.blogspot.com
"JamesB" wrote:
>
"Adam Bieganski" <abieganski(at)gmail.comwrote in message
news:D8**********************************@microsof t.com...
Hi JamesB,
Try:
ServiceController sc = new ServiceController("ServiceName");
sc.Stop();
The code makes sense - but where can I put that in a setup project? (Sorry,
I'm not too clever at setup stuff!)