0

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.

  • Maybe you can give us the XML file itself to look at? [One sample here](https://stackoverflow.com/a/49162863/129130). – Stein Åsmul Jun 06 '19 at 22:27
  • Possible duplicate of [Unable to find node in XML file](https://stackoverflow.com/questions/54177217/unable-to-find-node-in-xml-file) – zett42 Jun 13 '19 at 19:53

0 Answers0