none
Getting a "No public installers with the RunInstallerAttribute" when running my windows service program"

    Question

  •  

    I am relatively new to this process and I have a question. I used the Windows VC2005 designer got C++ to create  Windows Service program. When I launched it "ccs-ds_service -Install", I get the following error:

    No public installers with the RunInstallerAttribute.Yes attribute could be found
     in the C:\informent\srvrdev\rel7.2\server_utility\ccs_ds_service\debug\ccs_ds_service.exe assembly.
    Remove InstallState file because there are no installers.

     

    Here is a snippet of my code:

     

    #using <System.dll>

    #using <System.Configuration.Install.dll>

    using namespace System;

    using namespace System::Collections;

    using namespace System:Tongue TiederviceProcess;

    using namespace System::ComponentModel;

    using namespace System::Configuration::Install;

    using namespace std;

     

    [RunInstaller(true)]

    public ref class ccs_ds_serviceWinService : public System:Tongue TiederviceProcess:Tongue TiederviceBase

    {

    public:

    ccs_ds_serviceWinService()

    {

    InitializeComponent();

    //

    //TODO: Add the constructor code here

    //

    }

     

    protected:

    /// <summary>

    /// Clean up any resources being used.

    /// </summary>

    ~ccs_ds_serviceWinService()

    {

    if (components)

    {

    delete components;

    }

    }

     

    virtual void OnStart(array<String^>^ args) override

    {

    // TODO: Add code here to start your service.

    }


    /// <summary>

    /// Stop this service.

    /// </summary>

    virtual void OnStop() override

    {

    // TODO: Add code here to perform any tear-down necessary to stop your service.

    }

     

    private:

    /// <summary>

    /// Required designer variable.

    /// </summary>

    System::ComponentModel::Container ^components;

    #pragma region Windows Form Designer generated code

    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    void InitializeComponent(void)

    {

    this->components = gcnew System::ComponentModel::Container();

    this->CanStop = true;

    this->CanPauseAndContinue = true;

    this->AutoLog = true;

    this->ServiceName = L"my name";

    }

    #pragma endregion

    }

     

    The main part.

     

    if (argc >= 2)

    {

    if (argv[1][0] == _T('/'))

    {

    argv[1][0] = _T('-');

    }

    if (_tcsicmp(argv[1], _T("-Install")) == 0)

    {

    array<String^>^ myargs = System::Environment::GetCommandLineArgs();

    array<String^>^ args = gcnew array<String^>(myargs->Length - 1);

    // Set args[0] with the full path to the assembly,

    Assembly^ assem = Assembly::GetExecutingAssembly();

    args[0] = assem->Location;

    Array::Copy(myargs, 2, args, 1, args->Length - 1);

    AppDomain^ dom = AppDomain::CreateDomain(L"execDom");

    Type^ type = System:Surprisebject::typeid;

    String^ path = type->Assembly->Location;

    StringBuilder^ sb = gcnew StringBuilder(path->Substring(0, path->LastIndexOf(L"\\")));

    sb->Append(L"\\InstallUtil.exe");

    Evidence^ evidence = gcnew Evidence();

    dom->ExecuteAssembly(sb->ToString(), evidence, args);

    }

    }

    else

    {

    ServiceBase::Run(gcnew ccs_ds_serviceWinService());

    }

     

    I haveput in the RunInstaller to true. I have read on the Internet about doing this. I think I am still missing something here. I have tried to add Installer to my ref class but it complains that I can not have more than one. The Installer is in the ServiceProcess class. Do I need to add the installer code to my ref class?

    ccs_ds_serviceWinService()

    {

    ServiceInstaller^ serviceInstaller1;
       ServiceInstaller^ serviceInstaller2;
       ServiceProcessInstaller^ processInstaller

     

        processInstaller = gcnew ServiceProcessInstaller;
          serviceInstaller1 = gcnew ServiceInstaller;
          serviceInstaller2 = gcnew ServiceInstaller;
         
          // The services run under the system account.
          processInstaller->Account = ServiceAccount::LocalSystem;
         
          // The services are started manually.
          serviceInstaller1->StartType = ServiceStartMode::Manual;
          serviceInstaller2->StartType = ServiceStartMode::Manual;
         
          // ServiceName must equal those on ServiceBase derived classes.           
          serviceInstaller1->ServiceName = "Hello-World Service 1";
          serviceInstaller2->ServiceName = "Hello-World Service 2";
         
          // Add installers to collection. Order is not important.
          Installers->Add( serviceInstaller1 );
          Installers->Add( serviceInstaller2 );
          Installers->Add( processInstaller );

    }

     

     

    Any help would be appreciated.

     

    Monday, December 03, 2007 3:35 PM

Answers

All replies