[wix-users] When to Schedule Custom Commit Actions?
bryand at recastsoftware.com
Mon Aug 30 16:50:44 PDT 2021
I've got a service that relies on assemblies that must be in the GAC. The GAC requirement is a non-negotiable unfortunately: we integrate into a system that does not accept private assemblies. According to the ServiceControl table docs (here<https://docs.microsoft.com/en-us/windows/win32/msi/servicecontrol-table>) that means I can't rely on the default ServiceStart action because GAC assemblies aren't registered until InstallFinalize. The solution suggested: "you must use a custom action sequenced after the InstallFinalize action or a commit custom action". You generally need to be elevated to start a service and you can't have a deferred custom action after InstallFinalize. Right now I'm using WixQuietExec64 to call 'sc start' with Execute="commit". I tried not scheduling it in InstallExecuteSequence and scheduling it after InstallFinalize but neither worked so I ending up scheduling it Before="InstallFinalize". Right now it's 'working' but the logs seem to show that my commit action is finishing before InstallFinalize is finishing . That has me slightly concerned that it's just a race condition working in my favor. The service takes a few seconds to start and load the assemblies and it's just routinely being beaten by InstallFinalize.
So, am I doing this right? Is that when I should schedule that kind of commit action? Or is there some better (non-wrapper) way to do this?
More information about the wix-users