My deployment project was missing Custom Actions. I found instructions
of the address http://support.microsoft.com/kb/816169
Now it's going into services ok, but I'm having the same problem as you
- how to start this service using only Setup and Deployment project without:
1. booting computer
2. or going into Start/Control Panel/Administrative Tools/Services and
start it there.
3. or using NET START MyService -command
thanks for the tip anyway!
Claire kirjoitti:
> Go into visual studio help and look for "services, adding installers"
>
> In my vis studio 2005 help it's at url
> ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_radcon/html/8b698e9a-b88e-4f44-ae45-e0c5ea0ae5a8.htm
> I've not worked out yet how to get the service to start after installation,
> so if you work it out then please post back here lol
Claire - 13 Mar 2008 12:05 GMT
Hi again :)
Try adding something like the following into the OnInstalled/Committed event
of your ProjectInstaller class. I've only tested the following inside a
regular form so far as Im not quite sure which event I should be trapping
using System.ServiceProcess;
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
{
public ProjectInstaller()
{
InitializeComponent();
}
private void ProjectInstaller_Committed(object sender, InstallEventArgs e)
{
string servicename = "my.service";
System.ServiceProcess.ServiceController[] services;
services = System.ServiceProcess.ServiceController.GetServices();
bool Found = false;
foreach (ServiceController sc in services)
if (string.Compare(servicename, sc.ServiceName, true) == 0)
Found = true;
if (Found)
{
ServiceController Controller = new ServiceController(servicename);
if (Controller.Status == ServiceControllerStatus.Stopped)
Controller.Start();
}
}
}