Results 1 to 7 of 7

Thread: [RESOLVED] Install windows service via Setup and Deployment project

  1. #1

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Resolved [RESOLVED] Install windows service via Setup and Deployment project

    Hi Guys,

    long time no post... I've been busy with work and other bits and bobs and not really had much time for programming...
    but anyway, I have just written a fairly simple windows service in VB.NET and although I can install it on my PCs/servers using the command line InstallUtil.exe component, this isnt ideal for other people that may need to install it without my assistance.

    So basically I just need to know how to get a normal Setup and Deployment VS project to install this service itself... I thought it would be as simple as selecting the service assembly to include in the deployment project and building it, but unfortunately that seems to do naff all.
    Do I need to use a 'Custom Action' in the setup project (and if so, how/what do I do?) or is there a simpler way of doing this?

    Thanks
    Chris
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: Install windows service via Setup and Deployment project

    There is a good example in MSDN or at:
    http://msdn.microsoft.com/en-us/libr...64(VS.71).aspx

    Which shows how to do it but it does need the Custom Actions to install.

  3. #3

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Install windows service via Setup and Deployment project

    thanks that looks like just the thing
    I didnt realise in the Custom Actions you didnt actually need to do anything other than add the file you wanted to the custom actions section... seems a bit odd but if it works then im happy
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: Install windows service via Setup and Deployment project

    I agree it does seem a bit odd but it does work. You would think that at the least the Setup Project would detect that it is a service and add the Custom Actions for you.

  5. #5

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Install windows service via Setup and Deployment project

    yeah thats exactly what I was expecting to happen but it didnt
    anyway I followed that guide and its all working fine now the only thing I cant seem to get it to do is start the service once its installed but for this particular service that is actually a good thing because some config files need to be setup first before the service can run. Again though, im surprised there is no obvious option for this.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: [RESOLVED] Install windows service via Setup and Deployment project

    In the ProjectInstaller click on the ProcessInstaller and ServiceInstaller and you should see some helpful properties. The ProcessInstaller allows you to set the Account property (i.e. User, LocalUser, LocalSystem...). The ServiceInstaller has the StartType (i.e. Automatic, Manual...).

    Actually its fairly easy to include a new dialog for to have the installer configure your settings also. You would do this via CustomActions and your own .NET dll to perform those actions. If you wanted to go all out.

    Also see if these help:
    http://msdn.microsoft.com/en-us/libr...da(vs.71).aspx
    http://thedotnet.com/nntp/399639/showpost.aspx
    http://www.eggheadcafe.com/tutorials...ction-ins.aspx
    Attached Images Attached Images  
    Last edited by Edneeis; Apr 29th, 2009 at 07:52 PM.

  7. #7

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [RESOLVED] Install windows service via Setup and Deployment project

    Yeah i already found those settings thanks but just setting the service to automatic doesnt make it start after it has been installed. It just means that it will be started automatically next time windows starts, but when dealing with services on a server (which my service is) its going to be a long time before the machine gets rebooted again.

    Thanks for the extra links though
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width