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.
This will create *.{Configuration}.config files.
Have your base config implement the config node you’re going to transform.
Next, make your transforms according to the Web.config Transformation Syntax and save the file.
Settings.Debug.config
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!
Pingback: TDS 4.0 – Things you may have Missed | Sean Holmesby
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!
I haven’t seen this for a while. Are you using SlowCheetah as a plugin to create these transforms?
I remember an update to that changed something weird about the transforms and it touching files it didn’t previously.
TDS transforms will work without SlowCheetah, with just manually created transform files.
See here for an explanation:-
http://www.hhogdev.com/blog/2015/december/config-transforms.aspx
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.
Excellent, thanks. I’ve updated this now.