-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for windows services #9
Comments
Hi, after some researches and according to my current understanding, See this example, <!-- The files inside this DirectoryRef are linked to the Test Service directory via INSTALLFOLDER -->
<DirectoryRef Id="INSTALLFOLDER">
<!-- Create a single component which is the TestService.exe file -->
<Component Id="$(var.TestService.TargetFileName)">
<!-- Copies the TestService.exe file using the project reference preprocessor variables -->
<File Id="$(var.TestService.TargetFileName)" Source="$(var.TestService.TargetPath)" KeyPath="yes" />
<!-- Remove all files from the INSTALLFOLDER on uninstall -->
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<!-- Tell WiX to install the Service -->
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="TestService"
DisplayName="$(var.Name)"
Description="A Test Service that logs dummy text on an interval to a text file."
Start="auto"
ErrorControl="normal" />
<!-- Tell WiX to start the Service -->
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="TestService" Wait="yes" />
</Component>
</DirectoryRef> Where ServiceInstall must be within a Component and those little thing,
See also the File.KeyPath property,
The ServiceControl already defines setup/uninstall behaviors. Then compare with the current template here, under this Directory node, there should be a new component node to define services. One bogus thing, the File node of the ServiceInstall will be declared twice in one to many ways
Does it matter any how ? Will Wix complain or misbehave ? Next step is to work on the schema update of the file config, Note how a service file might end up being declared twice in files and (the tbd) services sections, I d familiarize with the demo to Then just code the update in a new PR, This update should not break api. For reference, check also, Given the existence of the ServiceInstall node it is not needed to involve a bat file to setup a service, imho. That s it! |
Thanks for the detailed description! However, after further digging, since:
I am thinking of simply implementing #2 and invoking As an alternative to invoking |
yes, this or that, i m happy to see this feature enhanced based on use cases that helps me to decide what s best. but great idea for sure. |
I stumbled across this issue today and I'm glad I did. I was planning on using it to install windows services in the coming weeks and hope it's possible by the time I get there. I'd suggest avoiding the scripting method with sc.exe if we can get this to work. I wrote a program in AutoIt in 2004 which essentially automated the ancestors of sc.exe from the Windows SDK and turned any .exe into a system service. It worked but was always a hack. It worked on Server 2003 and XP, but doubt it works today. Hopefully we can get the go-msi schema modified to support this. https://github.com/solvingJ/simpleservice-win-au3 |
@solvingj i m not very clear about AutoIt and how that works, nor what it requires prior to run. To go further, in any cases, i suggest to demonstrate the changes to apply to this demo program to install it as a service using this/or/that solution. In my experience windows service are painful to implement because the implementation needs to be aware. it is intrusive, yet necessary for fine grain response of the application to the os messages. |
Yeah, the AutoIt thing isn't helpful to us here. I don't know what the solution is, will have to look into it further. |
In many (or at least some) cases, golang binaries will work as a daemons executing 24/7
It would be great if the manifest was extended to define services. These services would be started automatically upon installation and stopped/removed on uninstallation.
Alternatively, we do this manually, but for that we need #2
The text was updated successfully, but these errors were encountered: