Gratziani V.
Gratziani V.

Reputation: 127

The name 'Installers' does not exist in the current context

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

Answers (2)

Cinchoo
Cinchoo

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

Steve
Steve

Reputation: 216303

You forgot to specify the base class

namespace ReviewsSvc 
{ 
    [RunInstaller(true)] 
    public class ReviewsSvcInstaller : Installer
    { 
        ....

Upvotes: 6

Related Questions