Hi I am using Xpath in my Nant build script to change some config variables between development and my other environments.
I have taken the syntax from this example:
The example looks like this:
<xmlpoke
file="config01/app.config"
xpath="/configuration/appSettings/add[@key='AppName']/@value"
value="TradeMonster">
</xmlpoke>
What I would like is something similar to this to search my connection strings and find all instances of "localhost\SqlExpress" and just change them to just "localhost"
Is this possible?
Toying with a quick'n dirty script here....
If you're sure there is only one connectionstring element in each file you can accomplish this with a combination of
xmlpeekandxmlpoke. Modifying the string is easier done with some C#, therefore using a script task to do a regex search and replace: