VS2013 Windows Service - How to make an installer?

I wrote a windows service.

Now I want to pack it into the installer.

I used the VS2013 x86 Native Tools Command Prompt and then used the commands:

To install it:

installutil httpapiservice.exe 

To remove it:

 installutil httpapiservice.exe /u 

It works great. I see a new service in the "Services" and stop and do not start it without problems.

Then I went to the right click on the project and selected "Publish", and he created the setup.exe file

But when I run setup.exe, I see that it โ€œdownloads and extractsโ€ the files. It seems that it is installed, but nothing is displayed in the "Services" section

Can someone tell me if I am doing this correctly?

thanks

+6
source share
5 answers

I ended up working with software, including installutil.exe, and simply gave instructions to the client to install and uninstall.

It seems to work fine.

NTN

+2
source

You need to add the configuration project to your solution to build the installer executable.

Unfortunately, Microsoft removed its installation project template from Visual Studio 2012 onwards, which would do the job.

This means that you are stuck in one of the alternatives that are either less functional, more difficult to configure, or expensive.

NOTE. Scroll down to EDIT 3 for my recommended solution. The rest of this post is just to highlight alternatives.

If you need a free route, you can add it to InstallShield Limited Edition in Visual Studio and use it to create a configuration project for your solution. It will work for Windows service installation projects in the latest version, but is usually considered pretty junk and limited. Here are the instructions for this: link

WiX is a free, open source alternative that is much more functional but difficult to configure.

EDIT -

This describes how to use WiX to create an installation project: http://www.schiffhauer.com/wix-template-for-installing-a-windows-service/

EDIT 2 -

Today (04/22/2014) Microsoft has restored the installation project in Visual Studio 2013 as an extension of Visual Studio - see this post

I have not tried it myself, but this is apparently the same as the VS2010 installation project, which was not too complicated to study (and there was a lot of information available on the Internet), I would definitely recommend that you try this for creating your setup program!

EDIT 3 (April 2016) -
I highly recommend that you use the Visual Studio Installer Projects Extension (as mentioned above) to create simple installers for your Windows services (and other programs). The creators he creates are simple, but professional enough to look good for simple or small projects.

Extension for Visual Studio 2013 is here
Extension for Visual Studio 2015 here
The extension for Visual Studio 2017 is here

In an article describing how to create an installation project for a Windows service using the old VS2010 installation project, here . Although this is an old article, it can be applied directly to the new Project Installer extensions mentioned above. (Thanks to EbbnFlow for the link)

+13
source

I recommend watching this video. https://www.youtube.com/watch?v=cp2aFNtcZfk

I tried and checked

+2
source

It seems you want to use ClickOnce (publish) to install the service. This is not possible without the hassle, but you can try to do it as described in this answer .

+1
source

These official Microsoft extensions provide support for Visual Studio installer projects in Visual Studio 2013 https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d and Visual Studio 2015 https://visualstudiogallery.msdn.microsoft.com / f1cc3f3e-c300-40a7-8797-c509fb8933b9

With this extension and the video in a previous post, I was able to create an installation project for a Windows service in Community Community Community 2015.

Do not forget to add custom actions for installation and uninstallation (as described in the video), and also do not forget to add the installer class to your service project in order to correctly install your service in the system โ†’ services.

I added serviceProcessInstaller and the serviceInstaller component by code and configured it like this:

 public XxxServiceInstaller() { InitializeComponent(); ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller(); ServiceInstaller serviceInstaller = new ServiceInstaller(); // Service Account Information serviceProcessInstaller.Account = ServiceAccount.LocalSystem; serviceProcessInstaller.Username = null; serviceProcessInstaller.Password = null; // Service Information serviceInstaller.ServiceName = "your service name"; serviceInstaller.DisplayName = "your service display name"; serviceInstaller.StartType = ServiceStartMode.Manual; // or automatic this.Installers.Add(serviceProcessInstaller); this.Installers.Add(serviceInstaller); this.AfterInstall += new InstallEventHandler(ProdSSSyncServiceInstaller_AfterInstall); } void XxxServiceInstaller_AfterInstall(object sender, InstallEventArgs e) { ServiceController sc = new ServiceController("your service name"); // start immediately sc.Start(); } 
+1
source

All Articles