O'Reilly logo

Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build by William Bartholomew, Sayed Ibrahim Hashimi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Replacing Values in Config Files

There will be many times that you will need to update an applications configuration file at build time. For example, you may need to update a connection string or the logging level. In order to update the configuration, we can use a set of XML-related tasks that is available from the Microsoft SDC Tasks library. You can find these at http://www.codeplex.com/sdctasks. In this example, I am going to update the config for the sample WindowsApplication1 project. The contents of the app.config file for that project are shown next.

<?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="configuration" value="default"/> <add key="webUrl" value="http://www.sedodream.com" /> </appSettings> </configuration> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required