Asp.net 读取字符串中的分号时nant脚本中的xmlpoke出现问题
我有一个nant脚本试图更改web.config中的URL值,但nant不断抛出以下错误:Asp.net 读取字符串中的分号时nant脚本中的xmlpoke出现问题,asp.net,ant,web-config,nant,xmlpoke,Asp.net,Ant,Web Config,Nant,Xmlpoke,我有一个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="my
'=' 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>
我可以xmlpoke web.config中的所有其他“添加键”,但这一个,所以这不是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脚本中的分号。我想我需要设法避开nant脚本中的分号。有人知道如何做到这一点或其他什么让它工作吗?已经16个小时了,没有人偷看。幸运的是,我在谷歌搜索了几个小时后找到了解决方案
解决方案是使用&;amp代码>。我不知道为什么额外的amp代码>但它起作用了。
现在我的nant脚本看起来是这样的:
<property name="myUrl" value="http://www.google.com/whatever?id=123456&amp;fullScreen=2"/>
我刚刚签署的信用证是:)