Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install a windows service onto a machine that doesn't have Visual Studio installed?

The only way to install windows-service I know is using "Visual Studio 2008 Command Prompt", Is there a way to install windows-service on a machine which isn't having Visual Studio installed (assume that .Net version 2.X is installed.)

like image 955
InfantPro'Aravind' Avatar asked Apr 08 '10 11:04

InfantPro'Aravind'


People also ask

How do I install Windows Service service?

In Solution Explorer, access Design view for the service for which you want to add an installation component. Click the background of the designer to select the service itself, rather than any of its contents. With the designer in focus, right-click, and then click Add Installer.


2 Answers

you can do it with installUtil which resides in the .net framework folder (on my machine it's C:\Windows\Microsoft.NET\Framework\v2.0.50727).

like image 54
Klaus Byskov Pedersen Avatar answered Sep 19 '22 12:09

Klaus Byskov Pedersen


You can install Windows Services as an MSI. Create the MSI as a normal Project attached to your Service Project.

In your Service Project Create an Installer Class and add the components serviceInstaller and serviceProcessInstaller and configure as required. Add the Project Output from the Service Project to the MSI Project, Set the Custom Actions of the MSI Project for Install, Commit, Rollback and Uninstall to the Output of the Service Project.

Alter the MSI Project in any other way as desired, build the MSI, then you will be able to install your Service to any Windows machine without VS.NET or by using the InstallUtil utility application. The MSI will also handle the Uninstall etc.

There are properties of the serviceProcessInstaller component which you can set for the Account to run the Service under, the serviceInstaller contains properties which can be set such as the Service Name. You will have to set the ServiceName and its Parent, MSDN will provide good information on how to use both of these components.

like image 38
Ivan Dormain Avatar answered Sep 21 '22 12:09

Ivan Dormain