Re: Same win service with different display names and description

Ryan Heath <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <[email protected]>
Perhaps implement your own installer which inspect the command line
and overrules the name at install time:

Something like this, the code is not tested, just typed right into gmail:

class MyServiceInstaller : ServiceInstaller
{
  public override void Install(IDictionary stateSaver)
  {
    // check cmd line
    if ( !string.IsNotNullOrEmpty( this.Context.Parameters["serviceName"]))
    {
      this.ServiceName = this.Context.Parameters["serviceName"];
    }

    // call normal behavior
    base.Install(stateSaver);
  }
}

// Ryan

On Mon, Nov 24, 2008 at 4:42 PM, Eddie Lascu <[email protected]> wrote:
>
> Interesting approach. I wonder if this could actually work. The problem is
> that I would have to differentiate between installers when I install the
> service. Do you know how to do that? I mean, installing the service is as
> easy as going:
>
> C:\>installutil yourproject.exe
>
> Looking at the installutil's parameters, I don't see a way of picking which
> installer you want to use, nor do I see a way of specifying the display name
> and the description for the service.
>
> So it appears that having multiple installers will not do the trick, but I
> might be wrong.
>
>
> Thanks,
> Eddie
>
>
>
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[email protected]] On Behalf Of Ryan Heath
> Sent: Monday, November 24, 2008 10:35 AM
> To: [email protected]
> Subject: Re: [ADVANCED-DOTNET] Same win service with different display names
> and description
>
> Would it work to add more than one installer of your service to your
> project?
>
> // Ryan
>
> On Mon, Nov 24, 2008 at 4:17 PM, Eddie Lascu <[email protected]> wrote:
>> Hi there,
>>
>> I have one windows service that I need to deploy 4 times on a
>> production server. Each service will control a different interface.
>> The interfaces are 100% similar so that is why it made sense to
>> develop only one service. Now, that I need to deploy them, I also need
>> to instantiate them with different display names and descriptions. The
>> display name and the description are properties of the
>> serviceInstaller object. Is there a way to change those two properties
>> other than changing them in my development environment and then
>> recompile the whole service? Is there some kind of configuration file
>> for the service itself where these properties would be stored and then
> read by the service during the installation phase?
>>
>> Thanks for your help,
>> Eddie
>>
>> ===================================
>> View archives and manage your subscription(s) at
>> http://peach.ease.lsoft.com/archives
>>
>
> ===================================
> View archives and manage your subscription(s) at
> http://peach.ease.lsoft.com/archives
>
> ===================================
> View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
>

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.