Add a new project to your Service project.
In Solution Explorer, right-click the Solution, point to Add, and then click New Project.
Under Project Types, click Setup and Deployment Projects or Setup and Deployment.
Under Templates, click Setup Project.
In the Name box, type ServiceSetup.
In the Location box, type C:\, and then click OK.
Tell the deployment project what the deployment project will package.
In Solution Explorer, right-click ServiceSetup, point to Add, and then click Project Output.
In the Add Project Output Group dialog box, click LogWriterService in the Project box.
Click Primary Output, and then click OK.
For correct installation, you have to add only primary output.
Add the custom actions
In Solution Explorer, right-click ServiceSetup, point to View, and then click Custom Actions.
Right-click Custom Actions, and then click Add Custom Action.
Click Application Folder, and then click OK.
Click Primary output from the service, and then click OK. Notice that Primary output appears under Install, Commit, Rollback and Uninstall.
By default, Setup projects are not included in the build configuration.
Build the solution
Right-click LogWriterService, and then click Build. Then, right-click ServiceSetup, and then click Build.
Install the service
Right-click ServiceSetup, and then click Install.
In the ServiceSetup dialog box, click Next three times. Notice that a progress bar appears while the Setup program is installing the service.
When the service is installed, click Close.