简体   繁体   中英

Installing a windows service without a set up project

I have written a standard simple .net windows service in c#. Now I am looking to install it and running it.

On MSDN, it says to add an installer to the project and create a setup project to deploy and install the service. http://msdn.microsoft.com/en-us/library/aa984263%28v=vs.71%29.aspx

I have added installers to my project. However I have Visual Studio 2012 which does not come with the setup project templates. What is the alternative to this?

Also I know that the Visual Studio Command Prompt can call InstallUtil.exe which supposedly can install services. What is the difference between this and installing it with the set up project? Would I still need installers in my project if I use InstallUtil.exe?

You can use installutil.exe in an elevated command window for this, as you stated.

The Installer tool is a command-line utility that allows you to install and uninstall server resources by executing the installer components in specified assemblies. This tool works in conjunction with classes in the System.Configuration.Install namespace.

This is no different from using the installer, as far as getting the service setup.

The best free setup solution for VS devs is WiX right now. The following thread explains how to install a service with it .

If you don't like scripting you can try Advanced Installer , its GUI based, much easier to use and faster. But you need a Professional edition, try it during trial, to install a service .

I would really recommend that you check out TopShelf: https://github.com/phatboyg/Topshelf

You can develop your service as a console application and then deploy it as a service by running the .exe with -install on command line. No fuss with installer projects.

If you want to create simple installer then try NSIS (Nullsoft Installation System) - it has a lot of plug-ins ( http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin ) which can help you with registering/starting/stopping/... you service.

If you want to create an Installer Project directly in Visual Studio you can use my tool (sorry for self promo) called Visual & Installer - download free Trial here: http://www.unsigned-softworks.sk/visual-installer/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM