— New online course!  Azure App Services & App Service Security with ASP.NET Core — Special launch price 50% off —

TFS Build / Release Configuration Utilities: Edit app.config, web.config, appsettings.json, and XML


When you’re working automated builds and automated releases, you frequently need to edit configuration files like app.config, web.config, and appsettings.json. Well, I wrote a command line utility to do this and I figured I’d share.  I’ve got a version that is an .exe that can be used on a Windows build agent and I’ve got a version that’s written with .NET Core and can run cross-platform.  Both of them have the same commands.

Here are the commands:

gets a value from <appSettings> in app.config or web.config

sets a value in <appSettings> in app.config or web.config

does a string replace in a file and replaces all occurences of a token (example: %%CONNECTIONSTRING%%) with an actual value

gets a connection string value from app.config or web.config

sets a connection string value in app.config or web.config

sets a value in a json file such as appsettings.json

locates an element in an XML file and sets an attribute value on that element

Here are the downloads:
Source code
EXE version for Windows
Cross-platform Binaries for .NET Core

I hope that these are helpful.


— Want to do cross-platform or Azure DevOps with ASP.NET Core and TFS? Need some help automatically deploying Entity Framework or Entity Framework Core migrations from your TFS Builds and TFS Releases? Not quite sure where to start? We can help. Drop us a line at info@benday.com

One Response to "TFS Build / Release Configuration Utilities: Edit app.config, web.config, appsettings.json, and XML"
  1. Hi Ben,

    Thanks for putting out this awesome utility!

    I’m using it to update the appsettings.json out of our on-prem TFS 2018 release (the Web App Deploy task available for on-prem doesn’t have json variable substitution).

    I did notice one issue: The TFS commandline task does not fail when it encounters an error even if “Fail on Standard Error” is checked. It marks the task as “successful” even though it shows the error on the log.

    This can be easily fixed by changing line 63 in Benday.BuildUtilities\program.cs (and similar in .NET Core). Change from

    And then the TFS task fails as expected when it can’t find the file for example.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: