Scott Woodgate's OutBursts

Making it easier to automate modifications to deployment binding files

Mariusz Borsa with a little tweaking from Erik Leasburg wrote this simple but nevertheless cool little utility that takes:

1. An input xml (e.g. a deployment binding file)

2. An XPath (e.g. //PrimaryTransport/Address)

3. A value (e.g. http://productionwebserver/myurl)

4. An output xml name (e.g. my modified deployment binding file)

and appropriately modifies the information in the input file creating an output file. Why do you care? You care because with it you can automate changes in binding files for nightly build processes (upping the version number in assemblies for example) or as you go from development to production.  Good stuff.

Published Wednesday, June 09, 2004 8:56 AM by scottwoo

Comments

 

Nic Wise said:

Oh dear. This has to be the single most useful thing I've come across for a very long time. Thanks to everyone (especially for releasing the source!)
June 10, 2004 4:43 PM
 

TDuser said:

NAnt has a task doing this.
<xmlpoke>
Replaces text in an XML file at the location specified by an XPath expression.

The location specified by the XPath expression must exist, it will not create the parent elements for you. However, provided you have a root element you could use a series of the tasks to build the XML file up if necessary.

The example will change the server setting in the above configuration from testhost.somecompany.com to productionhost.somecompany.com.

<xmlpoke
file="App.config"
xpath="/configuration/appSettings/add[@key = 'server']/@value"
value="productionhost.somecompany.com" />
June 11, 2004 10:35 AM
New Comments to this post are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker