I know I will chase this one for ever if I don't put it up here...
We ran into a situation where we needed to tweak the AppSettings-section of an configuration before tests in the build script.
Luckily there is help to be found. With the XmlUpdate-task (in the MSBuild Community Tasks) this can be accomplished. IF you know how to write the XPath-query.
Here is how (found it here):
<XmlUpdate
Namespace="http://schemas.microsoft.com/.NetConfiguration/v2.0"
XmlFileName="$(SourceDir)\Core\ABSuite\ABClient\App.config"
Xpath="//configuration/appSettings/add[@key='Main.ConnectionString']/@value"
Value="$(DatabaseConnectionString)"
/>
Also here is a great site to pick up some XPath-skills.
If you liked this post ... here's more for you:
Published by
on Last updated