我有一个nant脚本试图在web.config中更改一个url值,但是nant不断抛出这个错误:
'=' is an unexpected token. The expected token is ';'. Line 1, position 80.
我把它追溯到了nant脚本的URL中的分号。首先,我在URL中使用分号的原因是web.config不喜欢使用分号(&)。所以我不得不用
&
. 这是我的web.config值:
<appSettings>
<add key="myUrl" value="http://www.google.com/whatever?id=myId&fullScreen=1"/>
</appSettings>
我可以在web.config中使用xmlpoke来添加所有其他的“添加键”,但这一个除外,所以这不是一个xpath问题。
这是南特剧本:
<property name="myUrl" value="http://www.google.com/whatever?id=123456&fullScreen=2"/>
<xmlpoke
file="${config.file}"
xpath="/configuration/appSettings/add[@key = 'myUrl']/@value"
value="${myUrl}">
</xmlpoke>
所以问题不在于web.config中的分号,而在于nant脚本中的分号。我想我需要以某种方式避开南特脚本中的分号。有人知道怎么做或做其他什么来让它工作吗?