Visual Studio Programmer's Guide for the .NET Framework 
How to: Install and Uninstall Services 

Unlike most projects you create in Visual Studio, Windows Service projects cannot be run directly from the development environment by pressing F5. This is because the service in the project must be installed before the project can run.

You can quickly install your service application by using a command-line utility called InstallUtil.exe. You can also create a setup project that contains your project's output and create a custom action with it that will run the installers associated with the project and install your service. For an example, see Walkthrough: Creating a Windows Service Application in the Component Designer. For more information on setup projects, see Setup Projects. For more information on custom actions, see Walkthrough: Creating a Custom Action.

To install your service manually

  1. Access the directory in which your project's compiled executable file is located.

  2. Run InstallUtil.exe from the command line with your project's output as a parameter. Enter the following code on the command line:

    installutil yourproject.exe

To uninstall your service manually

  • Run InstallUtil.exe from the command line with your project's output as a parameter. Enter the following code on the command line:

    installutil /u yourproject.exe
    NoteTip

    You can launch Server Explorer and verify that your service has been installed or uninstalled. For more information, see How to: Access and Initialize Server Explorer/Database Explorer.

See Also

Tags :


Community Content

HulaHoops
How to create a Installer for Windows services?

I created a Installer for my Windows service, but it installs it as a 'program' [visible in add remove programs] not as a service. I got through the issue using the installutil, but just wondering how can this be done via a installer?

Just a tip, installutil is located in the Windows folder [WINDOWS\Microsoft.NET\Framework\v2.0....]

thanks

das

You need to add a custom action to your setup project. Right click on setup project, select View Custom Actions. Right click on the Custom Actions node and select Add Custom Action. In the Select Item in Project dialog double click on Application Folder then select 'Primary Output from...' and select OK. The Install, Commit, Rollback and Uninstall nodes should contain 'Primary Output from...'

Now rebuild setup project. After running the setup msi file the service will now be installed.
Tags :

Page view tracker