SubstituteApp on GitHub red-stronghold/SubstituteApp

Add ons


SubstituteApp.EPiServer on GitHub red-stronghold/SubstituteApp.EPiServer


SubstituteApp.Robots on GitHub red-stronghold/SubstituteApp.Robots

Project page

Substitution of any config, text or code file before compilation. Support of different substitutions based on build flavor (i.e. Debug, Release etc.)

Perfect for generation of complete sites including all neccesary files.

Enables you to put environment specific values under source control.

Available on the official NuGet feed

SubstituteApp and all add ons are available on the official NuGet feed
Use the NuGet to get a quick start. Basic setup are included in the package installer.

NOTE: For the moment I dont have a working uninstall-script, so you have to remove some files and delete the pre-buildevent manually if you want to uninstall the NuGet package.


  1. Create a file with the same name as the file you want to make substitutions in. But add an additional extension, same file extension as the file you want to generate.
    I.e. web.config.config, robots.txt.txt or crossdomain.xml.xml
  2. Create a file with your substitutions. Name it whatever you want, but it will contain XML-data so a XML-file would be just fine. I.e. "web.config.substitute.xml"
    • Format the XML-file as the ""XML-Format - Substitution" section below)
  3. Add the SubstituteApp.exe to you project. The "Libraries"-folder (or "External" etc.) could be a suitable place.
  4. Add a SubstituteApp.config.xml to your project and populate it with the XML according to the "XML-Format - Config"-section below
  5. Add a line to your pre-build event, in your project. I.e. $(SolutionDir)Libraries\SubstituteApp\SubstituteApp.exe $(ConfigurationName) SubstituteApp.config.xml $(ProjectDir) The example shows when the SubstituteApp.exe is located in folder \Libraries\SubstituteApp\
  6. Exclude the result file from Source Control (NOT exclude from project).
    In VS2010 using TFS:
    • Mark the file by clicking on it
    • Go to: File->Source Control->Exclude 'YourFile' from Source Control


  1. Build flavor name (use $(ConfigurationName))
  2. Path to SubstituteApp.config.xml, relative to project root folder.
  3. Path to your project (use $(ProjectDir))
  4. If path (3.) contains whitespaces the app will believe additional parameters are sent in. These will be concaternated in the app with a whitespace between.

What happens

The app search the template file for keys and substitutes them with the value defined in the substitution-xml-file. The app also remove the readonly attribute of the target file. In order to be able to write to it.

XML-Format - Config


<?xml version="1.0" encoding="utf-8" ?>
 <substitute name="web.config">

XML-Format - Substitution


<?xml version="1.0" encoding="utf-8" ?>
  <configuration name="Debug">
    <item key="Key1">Value1</item>
    <item key="Key2">Value2</item>
  <configuration name="Release">
    <item key="Key1">Value3</item>
    <item key="Key2">Value4</item>


The app will fail if...

Welcome to GitHub Pages.

This automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:

$ cd your_repo_root/repo_name
$ git fetch origin
$ git checkout gh-pages

If you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.

Designer Templates

We've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.

Rather Drive Stick?

If you prefer to not use the automatic generator, push a branch named gh-pages to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.

Authors and Contributors

You can @mention a GitHub username to generate a link to their profile. The resulting <a> element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.

Support or Contact

Having trouble with Pages? Check out the documentation at or contact and we’ll help you sort it out.