读取字符串中的分号时,在nant脚本中使用xmlpoke时出现问题

gok*_*ter 2 asp.net ant nant web-config xmlpoke

我有一个试图在我的web.config中更改URL值的nant脚本但是Nant一直在抛出这个错误:

'=' is an unexpected token. The expected token is ';'. Line 1, position 80.
Run Code Online (Sandbox Code Playgroud)

我将其追溯到nant脚本的URL中的分号.我首先在URL中使用分号的原因是因为web.config不喜欢&符号(&).所以我不得不替换和&.这是我的web.config值:

<appSettings>
    <add key="myUrl" value="http://www.google.com/whatever?id=myId&amp;fullScreen=1"/>
</appSettings>
Run Code Online (Sandbox Code Playgroud)

我能够在web.config中xmlpo所有其他"添加键"但是这个,所以它不是一个xpath问题.这是nant脚本:

<property name="myUrl" value="http://www.google.com/whatever?id=123456&amp;fullScreen=2"/>

<xmlpoke 
   file="${config.file}"
   xpath="/configuration/appSettings/add[@key = 'myUrl']/@value"
   value="${myUrl}">    
</xmlpoke>
Run Code Online (Sandbox Code Playgroud)

所以问题不在于web.config中的分号,而是在nant脚本中使用分号.我想我需要以某种方式逃避nant脚本中的分号.任何人都知道如何做到这一点或其他什么来让它工作?

gok*_*ter 5

已经16个小时了,不是任何人偷看的.幸运的是,经过几个小时的谷歌搜索,我找到了解决方案.

解决方案是使用&amp;amp;.我不知道为什么额外amp;但它有效.所以现在我的nant脚本看起来像这样:

<property name="myUrl" value="http://www.google.com/whatever?id=123456&amp;amp;fullScreen=2"/>
Run Code Online (Sandbox Code Playgroud)

从nant-users邮件列表中获取信用额度,我刚刚订阅了:)