0

I'm using https://github.com/kardianos/service to implement service installation/start/stop into my Go project, as I want to run it as a daemon.

The sticking point here is that I want to use something like Wix to create an msi installer for my service. My issue is that the documentation and several articles online seem to contradict each other.

How would I go about using Wix (or any other provider) to create an installer for my service?

kostix
  • 51,517
  • 14
  • 93
  • 176
Adam Thomason
  • 11
  • 1
  • 1
  • That really depends on your application. I'm not sure SO is the correct place to get a step-by-step tutorial on creating a windows installer package. – Adrian Dec 04 '17 at 14:24
  • A Windows service written in Go has no difference from any other Windows service written in any other language which provides a so-called "self-hosting" service (that is, a service coming in the form of an executable file — as opposed to a DLL file hosted via `svchost.exe`). So your question has nothing to do with Go. Read tutorials on WiX; specifically on how to package a Windows service with it. – kostix Dec 04 '17 at 14:53
  • One more point is that WiX is hard (and MSI in general is), so I would recommend to pick the path of the least resistance first and use [InnoSetup](http://www.jrsoftware.org/isinfo.php) for a start (which is really a no-brainer) and then move on to WiX if/when you will feel like that. – kostix Dec 04 '17 at 14:54
  • I would start with IsWiX. (Disclaimer: I'm the maintainer of this FOSS project.) It's designed to give the developer project templates and graphical designers to author 99% of the XML. It's a bit of a minimum viable product concept that handles a variety of scenarios but also allows for manual authoring of XML as the developer learns more about WiX. Contributors are welcome to assist in writing additional designers to broaden the scope of what IsWiX can do automatically. – Christopher Painter Dec 05 '17 at 11:52
  • In this 2 minute video I create a Windows Service and package it using IsWiX/WiX. https://www.youtube.com/watch?v=bxbcPnjfzIc Half of that time is spent creating the service so really it's 1 minute to create the WiX. The only thing different here is the one line of XML (RegistryValue) that is needed to tell SrvAny.exe how to launch the go application. IsWiX really does make it that easy to start. – Christopher Painter Dec 05 '17 at 11:56

1 Answers1

3

Start by reading through this tutorial on windows services:

https://github.com/iswix-llc/iswix-tutorials

Now read this article to understand how any old script/EXE can be made a service using srvany.exe:

https://support.microsoft.com/en-us/help/137890/how-to-create-a-user-defined-service

Take a look at my answer to see how it all comes together:

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

If that still isn't enough, send me an email and I'll give you a complimentary 30-60 minute session to show you.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100