- On the File menu, point to Add Project, and then choose New Project.
- In the Project Types pane, select the Setup and Deployment Projects folder.
- In the Templates pane, select Setup Project.
Add the Windows Service exe to the setup project:
- In Solution Explorer, right-click Setup, point to Add, then choose Project Output. The Add Project Output Group dialog box appears.
- ServiceName is selected in the Project box.
- From the list box, select Primary Output, and click OK.
- A project item for the primary output of ServiceName is added to the setup project. Now add a custom action to install the ServiceName.exe file.
Add a custom action to the setup project:
- In Solution Explorer, right-click the setup project, point to View, then choose Custom Actions. The Custom Actions editor appears.
- In the Custom Actions editor, right-click the Custom Actions node and choose Add Custom Action. The Select Item in Project dialog box appears.
- Double-click the application folder in the list box to open it, select primary output from ServiceName (Active), and click OK. The primary output is added to all four nodes of the custom actions: Install, Commit, Rollback, and Uninstall.
- Build the setup project.