I am trying to set host values in my service config file using Wix's util:XmlFile. To select nodes I want to use XPath with start-with function to be able to change multiple nodes.
I have tried XPath expression on https://www.freeformatter.com/xpath-tester.html and it works fine.
<util:XmlFile
Id="SomeId"
Action="setValue"
Permanent="yes"
ElementPath="/configuration/system.serviceModel/services/service[\[]starts-with(@name,'Webservices') and ends-with(@name,'Service')[\]]/host/baseAddresses/add"
Name="baseAddress"
File="[#Service_exe_config]"
Value="[SERVICE_PROTOCOL]://[HOSTADDRESS]/Management/SomeService"
SelectionLanguage="XPath"
Sequence="1" />
XML:
<configuration>
<system.serviceModel>
<services>
<service name="MyCompany.Webservices.V123.Service">
<host>
<baseAddresses>
<add baseAddress="https://localhost/Service"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
From the installer, I got this error: 'Error 25532. Failed to find node:'. It would be nice if it works without error.