The following transfers are from: http://blog.csdn.net/chainan1988/article/details/7087006
There are two ways to install the window service:
First, the command installation
Through the command window, execute the InstallUtil.exe service path to install the window service, do you think I'm pulling, what a long command to look at? How do you remember? Can think of if the client is a person who does not understand the program is not possible to complete the installation, then can make a simple and effective, point button can be installed, the answer is yes--installation program to create the program installation program: Solution (right-click)-Increase- New Project--project type Select Install and deploy--Template Select Setup Project: After creation, install project (right-click)--View--File system
Since we are installing the service, we do not need the user desktop and the program menu, the Direct Application folder (right click)--and the project output into the diagram:
There are two points to note, a selection of items to install the service, two project selection below to select the main output, select OK, this step to add the installation program folder, next is to add to this installation program, here we add two basic operations, one is installed, one is uninstall. Setup project (right-click)--View--Custom actions
Above can see there are installation, commit, rollback, uninstall and so on, we first increase the installation operation, install (right-click)-Add custom action, will pop up a dialog
Select the Application folder and select the previously added main output item, OK, so this installation program to increase the operation of the installation, the same way to increase the uninstall operation, uninstall and install the only difference is the need to set a command parameter, not less,
Here Arguments Enter/U means that the unload command is equivalent to the installutil.exe/u service path, and here our installer is ready to build the installer project, which will generate Setup.exe and Setup.msi installation files, copy to Client, click Setup.exe just like installing QQ installation of our services, actually much better than QQ, QQ and advertising, we are pure green!
How to create a Windows Service installation package