This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.. Written by: Sayed Ibrahim Hashimi, Chuck England and Bill Hiebert
This is a nifty tool, and I definitely would recommend if you you work in an environment where you need to change configuration setting information often during deployment.
We had several self-inflicted wounds with accidentally testing applications that had config entries that pointed to production instead of the quality assurance environment. Because of this we searched and found Slow Cheetah that let us separate the configs into Development, QA, and Production. Things are a lot safer now. Thanks for creating this.
Watched the Visual Studio Toolbox video on this some time ago, but have only just installed it. The tool is great and Its saving me heaps of time! No more building and deploying just to diff config files. Thanks for the work on this extension!
That is a cool stuff. That is to be installed on a develoer computer (VS). But how can I install on build server? Do you have any installation program for that?
Hi Yuri, see my blog post at http://sedodream.com/2012/12/24/SlowCheetahBuildServerSupportUpdated.aspx regarding how to get it working for build servers.
It's on the backlog https://github.com/sayedihashimi/slow-cheetah/issues/39. Should be the next major feature I work on. For web projects this support is much trickier than non-web projects.
Excellent. My app.config's are now updated with a Test, PreProd or Prod SQL Server connection string, even when running (rather than Deploying) my apps. A lifesaver - thanks!
Hi Sayed,
I am using this on our dev and our CI server. The dev machines are using VS2010. It works fine with both command line and in the IDE with our build script. However, on the CI server which is Windows 2008 Server and have VS2010, it didn't run TransformAllFiles target in the automated process. But it works fine from command line running the same build script as an administrator on the CI server. I have tried to move the dll and the targets files to different locations in build workspace and out in other folders.
I finally changed our build service to run under a domain user with admin rights instead of local system account. And it started to work.
So it seemed to me that that target was skipped because either the target file or the dll was not imported. Is there a specific permission we need to set or is there something else I am missing?
Our build has both web projects and non web projects, the default Transformxml works fine for Web projects with local system account.
BTW, It's a really good tool
Thanks,
Hi Sayed,
I have an xml file as an embedded resource to be used for nhibernate configuration. I would like to embed the transformed file as the embedded resource rather than the original. Since the transformed files are copied in to the relative bin\$(Configuration) the build will and does include the non transformed file as the embedded resource. I was wondering if there is a simple way using "Slow Cheetah" to get the transformed file included as the embedded resource.
One way would be to run the transforms before the build begins and add the xml file as a Link from the bin\$(Configuration) so that you always get the transformed file rather that the original.
--Thanks
Hi Kamran, thanks for your feedback. This is not supported but you could always use the TransformXml task directly in your project files to realize such scenarios.
Hello Sayed and Kamran,
I am not at all familiar with msbuild tasks, but I also have the need to transform embedded .resx files and .settings files. Do either of you have suggestions how to modify the .csproj file to accomplish this?
Hi,
I want to add transforms to an EPiServer license file. However, for this to be maintainable I need to replace all content in License.config. When I'm adding xdt:Transform="Replace" to the root node I get the following error:
"Could not write Destination file: Cannot insert the node in the specified location."
This applies to any file except Web.config. Any thoughts on this?
Hello,
In our project we use a custom transformation dll by using the following syntax:
<xdt:Import path="C:\Program Files (x86)\MSBuild\Custom\asdasd.Configuration.CustomTransforms.dll"
namespace="asdasd.Configuration.CustomTransforms" />
This dll is tested and it worked, however after installing the plugin i'm not able to preview the changes in a transformation which use this dll.
Hi Marco, sorry for the late response here. SlowCheetah will likely not work with existing custom transforms. I will add this to the backlog, can you tell me what your transform is doing? I'm just curious.
Trying to get started in vs2010 console app but can't get past this compile error:
The "SlowCheetah.Tasks.TransformXml" task failed unexpectedly.
System.UriFormatException: Invalid URI: The URI is empty.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at SlowCheetah.Tasks.TransformXml.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
I changed app.debug.config and release.config to content. Not sure which URI it's talking about. Is there some special setup required for console apps?
I created a console project. My solution contains 2 other solution configurations (beyond Debug and Release).
When I selected Add Transform on the app.config all it created was Debug and Release. I would have expected the other 2 as well. I tried setting my config to one of the other configs not generated and tried 'Add Transform' with no luck.
How can I get configs the the other platform configurations generated without manually hacking the .csproj file?
Thanks.
I figured it out. I forgot a step. In Configuration Manager I forgot to create a project configuration for my other 2 setups. Once I did that, the 'Add Transform' worked as I expected and generated the other 2 app.config files.
Some of the older projects in my solution have those configurations setup. The new console project I forgot to do that.
Thanks.
Does anyone know if Visual Studio 11 will have this functionality available by default? I'm looking at the Visual Studio 11 Beta and I can't see anything... Such a useful tool.
I would like to back-port the MSBuild targets and tasks to MSBuild 3.5 (VS 2008). Have you open-sourced this project? If not, would you consider doing so and accepting contributions? Thanks!
I have also experienced this problem. When the value tags are placed in the transformed output file, they are broken down, with the closing </value> tag on the next line. White space (spaces) is inserted on the line in front of the closing tag to form the indentation. You must be careful to use String.Trim when you retrieve the values or you will pick up this rogue white space.
Hello, I just upgraded to version 2.1 (currently the latest release), and my setup project is still not getting the transformed config file, but instead the original un-transformed file. When I run the project form within visual studio, slow cheetah works fine (the transformed file is in the bin folder). It is just my setup project that seems to be ignoring it. Any ideas why that might be?
Well, I tried to put a sample project together that re-created the issue and couldn't; it worked properly in my new sample project. So, obviously something was wrong with my existing project, so I started trying to force whatever needed to change to change. I deleted all references to slow cheetah from my .csproj file, nuked one of my transforms, and then right clicked the app.config and selected "Add Transform", it gave me the prompt that it was going to have to modify my project file. I checked my setup project and voila, fixed.
Of note: this was a preexisting project that was created with an old version of slow cheetah (don't remember which). Maybe that had something to do with it?