Transformer is easy to use tool to config transformations for JSON, XML and YAML based on Magic Chunks.
Everyone remembers XML Document Transform syntax to transform configuration files during the build process. But world is changing and now you can have different config types in your .NET projects.
Transformer allows you to transform you JSON, XML and YAML files. You can run it at MSBuild, Cake, PSake or Powershell script as well as use this Visual Studio Team Services build extension.
Transformer is based heavily on Magic Chunks and some of the forks with my own modifications as it appears that the original repository is no longer being monitored (outstanding pull requests). There were some bugs in the original library that did not handle some special characters.
How it works
The main idea is quite simple. Transformer represents transformation as a key-value collection.
The key contains path at source file which should be modified. And the value contains data for this path in modified file.
Imagine you have following JSON based configuration file.
So following transformations could be applied to this config:
As a result you will have:
Step 1: Install this extension into your VSTS account.
Step 2: In your build or release definition add new build step.
Step 3: Select "Config transformation" under "Utility" group and click "Add".
Step 4: Specify configuration file path and required transformations.
Alternately, specify a path to a file containing the transformations.
Step 5: Run build.