Wednesday, October 30, 2013

Creating a Deployment Project to Install a Windows Service

In the post Installing and Uninstalling a Windows Service, we have seen on how to Install and Un-Install a windows service using the InstallUtil tool, however when you want your service to be packaged for deployment into end user computer this approach might not work as the end user will not be aware of how to run the commands to install the service, in these cases we can create a deployment project which will automatically deploy the service to the computer.
In this post we shall see on how to create a Setup Project which will create a setup file to deploy the service. 
1.    Open the Windows Service Project Solution in VS.Net
2.    Add a new project of type “Setup Project” to the solution.
3.    I will name the setup project as NotificationServiceSetup. 
4.    You can set the Properties like Company, Author etc in the Set up project Properties.
5.    Once the Setup Project is created, right click on the project and select Add -> Project Output 
6.    Select the NotificationService project in the Projects dropdown and select, “Primary output” in the list box below. Click OK 
7.    Once again right click on the Setup Project and select View -> Custom Actions
8.    In the Custom Action panel, right click on Custom Actions and select “Add Custom Action” 
9.    Select “Application Folder” click OK 
10. Select “primary output from NotificationService (Active)”, click OK
11. Notice that the “Primary output from NotificationService” is added under Install , Commit, Rollback and Uninstall options.
12. Right click on the NotificationServiceSetup project and build the project
13. Once the build is completed, the setup file to install the service is created in the /Bin folder of the project. 
14. That’s it the setup project is ready, just double click on the .msi file and follow the instructions of the setup Wizard to install the Project.
15. Once the installation completes the NotificationService will get added to the list of services on the computer.

Search Flipkart Products:

No comments: