Search code examples
windows-serviceswixwindows-installerinstsrvsrvany

Wix installer to replace INSTSRV and SRVANY for user defined service installation


I created an executable MyService.exe using Visual Studio C# Express. There are no options in the Express version to create a service. In the past, this has been manually installed as a user defined service using the INSTSRV and SRVANY as described in the MSDN Article 'How To Create a User-Defined Service'

Is it possible to create a wix 3.5 installer for this file that

  1. doesn't require the existence of the SRVANY.exe and INSTRV.exe files on the target machine
  2. does not use INSTSRV.exe as a custom action

Solution

  • WiX does support installing Windows services, but only native ones. This means that the application must be written as a service.

    Since your application uses SRVANY.EXE to run as a service, you have two options

    • rewrite your application as a native Windows service

    or

    • use custom actions to execute the SRVANY.EXE and INSTSRV.EXE command lines