The most important part of the article you linked, is here
To add a custom action to the setup project
1.In Solution Explorer, right-click the setup project, point to View, then
choose Custom Actions. The Custom
Actions editor appears.
2.In the Custom Actions editor, right-click the Custom Actions node
and choose Add Custom Action. The
Select Item in Project dialog box
appears.
3.Double-click the application folder in the list box to open it, select
primary output from MyNewService
(Active), and click OK. The primary
output is added to all four nodes of
the custom actions ? Install, Commit,
Rollback, and Uninstall.
4.Build the setup project.
If you skip these steps, your setup project will build and copy your files to the correct directory; however, they will not register your binary as a service without these steps.
I should also note that this works for older versions of Visual Studio that had/have the built-in Setup/Deployment project template. The newer versions of Visual Studio have different setup/deployment projects (some requiring third party software.)
I'd recommend looking into WiX Toolset and check here for WiX Installation of Windows Services.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…