util:XmlFile开始-在ElementPath中不起作用

时间:2019-06-06 16:06:18

标签: wix

我正在尝试使用Wix的util:XmlFile在我的服务配置文件中设置主机值。要选择节点,我想将XPath与start-with函数一起使用,以便能够更改多个节点。

我已经在https://www.freeformatter.com/xpath-tester.html上尝试过XPath表达式,并且效果很好。

     <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>

从安装程序中,我收到此错误:“错误25532。无法找到节点:”。如果可以正常运行,那就太好了。

0 个答案:

没有答案