Assuming you have configured the Windows Service project, follow these steps to add a deployment project that packages the service application so that the service application can be installed:
- Add a new project to your LogWriterService project. To do this, follow these steps:
- In Solution Explorer, right-click Solution 'LogWriterService' (1 project), point to Add, and then click New Project.
- Click Setup and Deployment Projects under Project Types, and then click Setup Project under Templates.
- In the Name text box, type ServiceSetup.
- Type C:\ in the Location text box, and then click OK.
- In Solution Explorer, right-click Solution 'LogWriterService' (1 project), point to Add, and then click New Project.
- Tell the deployment project what to package. To do this, follow these steps:
- In Solution Explorer, right-click ServiceSetup, point to Add, and then click Project Output
- In the Add Project Output Group dialog box, in the Project box, click LogWriterService
- Click Primary Output, and then click OK.
- In Solution Explorer, right-click ServiceSetup, point to Add, and then click Project Output
- For correct installation, add only primary output. To add the custom actions, follow these steps:
- 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 LogWriterService (Active), and then click OK.
Notice that Primary output appears under Install, Commit, RollbackUninstall.
and
- In Solution Explorer, right-click ServiceSetup, point to View, and then click Custom Actions
- By default, setup projects are not included in the build configuration. To build the solution, use one of the following methods:
- Method 1
- Right-click LogWriterService, and then click Build.
- Right-click ServiceSetup, and then click Build.
- Right-click LogWriterService, and then click Build.
- Method 2
- On the Build menu, click Configuration Manager to build the whole solution.
- Click to select the Build check box for ServiceSetup.
- Press F7 to build the whole solution. When the solution is built, you have a complete installation package that is available for the service.
- On the Build menu, click Configuration Manager to build the whole solution.
- Method 1
- To install the newly built 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 service installs.
- When the service is installed, click Close.
No comments:
Post a Comment