无法使用util:XmlFile任务更新配置文件

时间:2014-03-17 09:41:54

标签: c# wix windows-installer

我尝试更新的配置文件如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

...

    <jmsConfigurationSection>
        <jmsConfigurations>

            <jmsServer address="t3://localhost:7001" login="weblogic" password="weblogic1">
                <jmsConnectionFactories>
                    <jmsConnectionFactory name="jms/ConnectionFactory-0">
                        <jmsQueues>
                            <jmsQueue key="MeterMeasure" queueName="jms/Queue-0" />
                            <jmsQueue key="MeterEvent" queueName="jms/Queue-0" />
                        </jmsQueues>
                    </jmsConnectionFactory>
                </jmsConnectionFactories>
            </jmsServer>

            <jmsServer address="t3://localhost:7002" login="weblogic" password="weblogic1">
                <jmsConnectionFactories>
                    <jmsConnectionFactory name="jms/ConnectionFactory-0">
                        <jmsQueues>
                            <jmsQueue key="GatewayConfiguration" queueName="jms/Queue-0" />
                            <jmsQueue key="GatewayEvent" queueName="jms/Queue-0" />
                        </jmsQueues>
                    </jmsConnectionFactory>
                </jmsConnectionFactories>
            </jmsServer>

        </jmsConfigurations>
    </jmsConfigurationSection>

</configuration>

我必须在MSI的上下文中更新此文件。我使用util:XmlFile这样的任务:

<xsl:element name="util:XmlFile">
  <xsl:attribute name="Id">SetMeterServerAddress</xsl:attribute>
  <xsl:attribute name="Action">setValue</xsl:attribute>
  <xsl:attribute name="ElementPath">/configuration/jmsConfigurationSection/jmsConfigurations/jmsServer/jmsConnectionFactories/jmsConnectionFactory/jmsQueues/jmsQueue/[\[]@key='MeterMeasure'[\]]/../../../../@address</xsl:attribute>
  <xsl:attribute name="Value">[ORACLEMDM_METER_SERVER_ADDRESS]</xsl:attribute>
  <xsl:attribute name="File">
    <xsl:value-of select="concat('[#', ../wix:File/@Id, ']')"/>
  </xsl:attribute>
  <xsl:attribute name="SelectionLanguage">XPath</xsl:attribute>
  <xsl:attribute name="Sequence">1</xsl:attribute>
</xsl:element>

但是任务在运行时失败并出现以下错误:

enter image description here

util:XmlFile任务中使用的XPath表达式在PowerShell脚本或控制台应用程序中完美运行。

有什么想法吗?

0 个答案:

没有答案