I’m putting together an install for a Windows Service (managed). I’d like to be able to update its config file based on user input from a dialog. The config file gets updated properly and the windows service gets installed, but it doesn’t look like the service is picking up the changes in the config. Am I messing up with the sequencing? I want to run my Custom Action “ServiceConfig” before the service gets installed and started.
Here is a scrubbed excerpt from my WiX files:
<Component Id="cmpXyzService.exe" Guid="NOTAREAL-GUID-90X5-12C5-ABC123XYZ890">
<File Id="file_XyzService.exe" KeyPath="yes" Source="$(var.SourceDir)\XyzService.exe" />
<ServiceInstall Id="InstallXyzService" Name="Service.XYZ" DisplayName="XYZ Service" Start="auto" Vital="yes" Interactive="no" ErrorControl="normal" Type="ownProcess" />
<ServiceControl Id="ServiceControlXyzService" Name="Service.XYZ" Start="install" Stop="both" Remove="uninstall" Wait="no"/>
</Component>
<CustomAction Id="SetPropertiesForService" Property="ServiceConfig" Value="[SERVICEINSTANCENAME],[CONFIGVALUE1],[CONFIGVALUE2]" />
<Binary Id="UpdateConfigFileCustomAction.CA.dll" SourceFile="$(var.UpdateConfigFileCustomActionDir)\UpdateConfigFileCustomAction.CA.dll" />
<CustomAction Id="ServiceConfig" BinaryKey="UpdateConfigFileCustomAction.CA.dll" DllEntry="EditConfigFile" Execute="deferred" Return="check" />
<InstallExecuteSequence>
<Custom Action="SetPropertiesForService" Before="ServiceConfig" >NOT Installed</Custom>
<Custom Action="ServiceConfig" After="InstallFiles" >NOT Installed</Custom>
</InstallExecuteSequence>
Here’s a trimmed-down copy of the InstallExecuteSequence table from Orca
StopServices VersionNT 1900 DeleteServices VersionNT 2000 RemoveFiles 3500 InstallFiles 4000 SetPropertiesForService NOT Installed 4001 ServiceConfig NOT Installed 4002 InstallServices VersionNT 5800 StartServices VersionNT 5900 RegisterUser 6000 RegisterProduct 6100 MsiPublishAssemblies 6250 PublishFeatures 6300 PublishProduct 6400 InstallFinalize 6600 RemoveExistingProducts 6601
Apologies if I have edited out something important – I didn’t want to dump everything I had. I believe I’ve included everything relevant.
As per last comment:
This caused a kerfuffle back in 2006. I did find this workaround though. Basically, WiX doesn’t recognize the RunInstallerAttribute.