Sean Holmesby

.NET and Sitecore Developer

By

Sitecore TDS 4.0 – Config Transforms

I originally published this post on the Igloo blog.

This blog post is about Team Development for Sitecore by Hedgehog Development, and the new config transforms feature in TDS 4.0.

Igloo were privileged to obtain the TDS 4.0 beta from Hedgehog recently, to have a play with the latest features.  One of those features that excited me was the inclusion of support for config transformations.

A lot of our projects use config transformations, and have custom code built into the MSBuild file to make these transforms. While TDS v3 had a File Replacement feature that you could use for changing files based on a Visual Studio configuration, it seemed a bit long-winded compared to just transforming the file. Luckily, the Solution Architect at Hedgehog Development, Sean Kearney, announced the config transform feature on his blog back in May, and since then I’ve been busting to get this implemented on our projects.

How do you get them working?

Firstly, install the SlowCheetah plugin into Visual Studio. It will allow you to make configuration transformations for config files other than your Web.Config file.

Now, right click on the config file you want to transform, and click Add Transform.

ConfigTransforms-01-Add-Transform

This will create *.{Configuration}.config files.

ConfigTransforms-02-Transform-Files

Have your base config implement the config node you’re going to transform.

ConfigTransforms-03-BaseConfigFile

Next, make your transforms according to the Web.config Transformation Syntax and save the file.

Settings.Debug.config

transforms

 

Getting it to Work

At first, I clicked around all the settings to find where I set it up, but couldn’t find anything. I had a look through the TDS targets file ( C:Program Files (x86)MSBuildHedgehogDevelopmentSitecoreProjectv9.0HedgehogDevelopment.SitecoreProject.targets) to see what was happening. Turns out, it’s does it itself!

So all you have to do is build your solution, and your config transformation will be made! No custom MSBuild script, no custom settings….just plain magic!

ConfigTransforms-05-TransformedConfigFile

5 Responses to Sitecore TDS 4.0 – Config Transforms

  1. Pingback: TDS 4.0 – Things you may have Missed | Sean Holmesby

  2. Travis says:

    Sean, we have this setup, and it works great. One problem we’re having is that whenever we do a build, the transform seems to trigger a touch on the web.config and that causes the entire application to restart every time, even if the only thing we changed was markup (or nothing). Have you run into this? It’s a productivity sink to have to wait for the app to restart on ever build!

  3. Jabare Mitchell says:

    xdt:Locator=”Match(name)” is the proper fix for this. When I use xdt:Match=”name” it changes the value of every under . That’s no good.

Leave a Reply

Your email address will not be published. Required fields are marked *