我有一个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中添加所有其他的"add key“,除了这一个,所以这不是一个xpath问题。下面是nant脚本:
<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脚本中的分号。我想我需要设法避开nant脚本中的分号。有没有人知道怎么做或者做点别的什么来让它工作?
发布于 2010-09-17 23:23:46
已经16个小时了,没有人偷看一眼。幸运的是,我在谷歌上搜索了几个小时后找到了解决方案。
解决方案是使用&amp;。我不知道为什么额外的amp;,但它工作。所以现在我的nant脚本看起来是这样的:
<property name="myUrl" value="http://www.google.com/whatever?id=123456&amp;fullScreen=2"/>这归功于我刚刚订阅的Gary from the nant-users mailing list :)
https://stackoverflow.com/questions/3729447
复制相似问题