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
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 firstname.lastname@example.org.