Wix Installer Windows Service

Active6 years, 8 months ago

I am trying to create a service using VS2012 express that will be installed with WiX. This is done without the templates provided in the full version of VS. I had my class derive from ServiceBase. I assumed (perhaps incorrectly) that if the program was installed using WiX that a class derived from ServiceInstaller was not necessary. When I run the MSI that is created by WiX, no errors are flagged, but no new service shows up.

I have Google searched for an answer, but didn't find an example of the miniumum C# code needed to create a service. Links to a good tutorial or pointing out the area where either the C# or WiX code is lacking would be appreciated.

Jun 20, 2013  As far as I know, Installer classes are not supported in WIX, Custom Actions are used instead. How do you call your code from WIX? WIX has a element for installing services. Although not allmighty, this element is very powerful and the preferred method to install Windows Services. See Installing and starting a Windows Service.

Wix Installer Windows Service

The code for the template service is:

Wix Code:

DarwinIcesurferDarwinIcesurferWix install windows service heat

Wix Toolset Install Service

5643 gold badges19 silver badges39 bronze badges

1 Answer

Wix

Your assumption that only ServiceBase is needed is correct. However you only need 1 component not 2 components in WiX. The ServiceInstall doesn't reference a file, it implicitly applies to the keyfile of the parent component.

If you need the ability to install the EXE and a console app and/or a service (variation point) that gets more complicated. The easiest is to factor into a DLL and create 2 EXE's with a total of 3 components.

Christopher PainterChristopher Painter

Wix Toolset Install Windows Service

49.2k6 gold badges53 silver badges90 bronze badges

Wix Install Windows Service

Not the answer you're looking for? Browse other questions tagged c#windows-serviceswix or ask your own question.