Saturday, June 13, 2009

Install WindowService using installutil.

This article is about to install to window service using installutil.exe. InstallUtil.exe or simply say installutil utility comes up with .NET Framework 2.0.

1. Create new Window Service Project.
2. After that open services1.cs in design mode . It looks like this.
3. Now right click on design window. It open popup menu with installer option.
4. When you click on Add Installer. It will will add new class called projectinstaller.cs. It contain serviceprocessinstaller1 and serviceinstaller component. ServiceProcess installer is used to configure service account and serviceinstaller contain information about service.
5. Apart from above ProjectInstaller.cs contain following code which is used to call from installutil.
In above code RunInstaller attribute marked as true. So InstallUtil take this thing into consideration and use this information to call installer.

To install using installutil open VS 2005/VS 2008 command prompt or go to  %windir%\Microsoft.NET\Framework\v2.0.50727.

installutil.exe /i  WindowService1.exe ( To Install ).

installutil.exe /u WindowSerivce1.exe ( To uninstall).

Installutil use Installer class (Projectinstaller) to install service.

If you mark RunInstlaller as false then this installutil not work.

If you don’t want to use installutil to install wndow service then go to

No comments: