[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?
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
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.
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.
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.
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.