I have a nant script that is trying to change a URL value in my web.config but Nant keeps throwing this error:
'=' is an unexpected token. The expected token is ';'. Line 1, position 80.
I traced it down to the semicolon in the URL of the nant script. The reason I have a semicolon in the URL in the first place is because the web.config doesn't like ampersands (&). So I had to replace & with &
. Here's my web.config value:
<appSettings>
<add key="myUrl" value="http://www.google.com/whatever?id=myId&amp;fullScreen=1"/>
</appSettings>
I'm able to xmlpoke all the other "add keys" in the web.config but this one, so it's not an xpath issue. Here's the nant script:
<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>
So the problem isn't with the semicolon in the web.config, but with the semicolon in the nant script. I guess I need to somehow escape the semicolon in the nant script. Anyone know how to do this or something else to get it to work?