Reputation: 127
I'm a total noob in developing windows services and I found a tutorial about implementing a standard windows service. This is the code that I found:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
namespace ReviewsSvc
{
[RunInstaller(true)]
public class ReviewsSvcInstaller
{
private ServiceProcessInstaller processInstaller;
private ServiceInstaller serviceInstaller;
public ReviewsSvcInstaller()
{
processInstaller = new ServiceProcessInstaller();
serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.StartType = ServiceStartMode.Manual;
serviceInstaller.ServiceName = "Reviews Updater";
Installers.Add(serviceInstaller);
Installers.Add(processInstaller);
}
}
}
I've added the necessary references but I still get an error about 'Installers' not found. What am I missing?
Upvotes: 2
Views: 1100
Reputation: 6322
Make sure the class ReviewsSvcInstaller in the main executable (EXE). The installer look for this class in the main entry assembly. I hope it helps.
Upvotes: 1
Reputation: 216303
You forgot to specify the base class
namespace ReviewsSvc
{
[RunInstaller(true)]
public class ReviewsSvcInstaller : Installer
{
....
Upvotes: 6