How to Developed Window service:

  1. Open VS.NET and then at the File menu click on New, Project. From the New Project Dialog Box, choose the Windows service template and name it WindowsServiceDemo
  1. Go to design view for Service1.
  2. Click the background of the designer to select the service itself, rather than any of its contents.
  3. Right click on form then In the Properties window, click the Add Installer link by default, two installers is added to your project. The component is named ProjectInstaller.
  4. ProjectInstaller consists ServiceInstaller1 and ServiceProcessInstaller1
  5. Access design view for ProjectInstaller, and click ServiceInstaller1.
  6. In the Properties window, set the ServiceName property to WindowsServiceDemo and Set the StartType property to Automatic.
  7. Access design view for ProjectInstaller, and click ServiceProcessInstaller1.
  8. In the Properties window, set account property Local System
  9. Implement Code.
  10. Create Setup.

Create Setup:

  1. Add new Project in same Solution and Select Setup and deployment then setup project and name it WindowsServiceSetup
  2. In Solution Explorer, right-click WindowsServiceSetup, point to Add, then choose Project Output. The Add Project Output Group dialog box appears.
  3. WindowsServiceDemo is selected in the Project box.
  4. From the list box, select Primary Output, and click OK.
  5. In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom Actions editor appears.
  6. In the Custom Actions editor, right-click the Custom Actions node and choose Add Custom Action. The Select Item in Project dialog box appears.
  7. Double-click the application folder in the list box to open it, select primary output from WindowsServiceDemo (Active), and click OK. The primary output is added to all four nodes of the custom actions — Install, Commit, Rollback, and Uninstall.
  8. Build the setup project to create Setup.