SlowCheetah is a great tool. I often use it in my daily work.
I work with Sitecore on daily basis and not too long ago I should upgrade a project. It’s hell every time!
So I tried to find a way, where I could just simple switch the web.config out with the new one, without worrying about all the changes we had made to it. I instantly started searching the web for a way on how to do this with SlowCheetah. Clearly I wouldn’t been the first to have this thought.
Google couldn’t give me the answer! But I didn’t give up, and I started reading about small hacks people had done with SlowCheetah and how they had made changes to the original slowcheetah.Transform.targets file.
It took some time, but I ended up with a result:
<Target AfterTargets="CoreCompile" Name="TransformWebConfigOnBuild" DependsOnTargets="TransformAllFiles;DiscoverFilesToTransform">
<Delete Files="$(_TargetConfig)" />
<Copy SourceFiles="$(_OriginalConfig)" DestinationFiles="$(_TargetConfig)" />
<Message Text="Following files will be used to transform $(_OriginalConfig) into $(_TargetConfig): @(_FilesToTransformNotAppConfig->'%0a%09bin\%(RelativeDir)%(Filename)%(Extension)')" Importance="high" />
Condition=" '%(Filename)%(Extension)' != '$(_TargetConfig)'
and $([System.Text.RegularExpressions.Regex]::IsMatch(%(RelativeDir), $(_RootTransformFolder)))
and '%(Link)'=='' " />
With this target, on every build (both on build server and local) the web.config is deleted, and a new one is created by copying Sitecore.config (sitecores original web.config) and then SlowCheetah transforms all your changes from your files (ex. system.webserver.config, system.web.config etc) into the web.config and you end up with a complete web.config file, containing both your and sitecores settings.
This gives great freedom in Sitecore upgrades, since we don’t have to locate our own changes beforehand.
Hope you can use this information