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
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!
It won't be included in VS2012, and at this time it likely wont ever make it into VS. If you think it should I suggest you make a suggestion at http://visualstudio.uservoice.com/ and have all your friends vote it up.
I have a Build Server, and every night it will automatically build the solution for 2 different configurations (Staging and Testing). It then publishes those, so the respective teams can test and explore the latest changes.
Is there anything I need to do so the Build Server transforms my config files correctly?
I have ConnectionStrings.config and two tranforms:
When I build the deployment package, the transforms are applied correctly. The problem is, all 3 files are included in the package instead of just a ConnectionStrings.config.
Further details: I can create the transforms by right-clicking on the main .settings file, but when running the tests it always takes whatever connection strings are setup in the main .settings file rather than the .debug.settings file.
.settings files do not work with Transforms. We had a discussion here regarding those at http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/view/Discussions/4#3944. The issue is that .settings files are converted to code so transforms won't work due to that.
I haven't had time to try this yet (I don't have access to a machine with VS installed right now), are you saying that for Web projects in order to Preview the project file gets modified? That shouldn't be the case, if it is could you open an issue at https://github.com/sayedihashimi/slow-cheetah/issues so that we can track this?
Hey there! Got it installed and tested. The builds transform OK. However...
'Package...' to Windows Azure does not. I have two transforms on my app.config in my Windows Azure Worker role: 'Release' and 'ReleaseTest'. When I compile the two output folders contain each a separate version of my app.config (renamed to match my project naturally).
However when I select 'Package...' on my Windows Azure deployment project and get my packaged deployment the transform does not happen. I open up the packages and extract out my .config files and compare. In both cases they get the values from the app.config and the transformations have not been done.
Do you think this would be hard to fix? The scenario is I want to transform my app.config for the worker role to deploy different cache configurations on different deployments.
This seems to work: http://wely-lau.net/2012/03/14/applying-config-transformation-app-config
In short, edit the csproj file for your worker role project and "Scroll down to the end of the file and add the following snippet before the closing tag of project:
<Import Project="$(CloudExtensionsDir)Microsoft.WindowsAzure.targets" />
<Target Name="CopyWorkerRoleConfigurations" BeforeTargets="AfterPackageComputeService">
DestinationFolder="$(IntermediateOutputPath)WorkerRole1" OverwriteReadOnlyFiles="true" />
Thanks Jeff for the pointer. This seems to be covering app.config for Azure worker roles. It seems like we should also support transforming other files as well. I am going to go ahead and add this support.
Jeff could you email me at sayedha [at] (microsoftDOTcom) so that I can send you the package once I have it for testing?
Hi Jeff, I have worked on this and may have something working. Can you checkout the discussion at https://github.com/sayedihashimi/slow-cheetah/issues/5#issuecomment-5972109 for more info and a link to download the bits? If you try it out please let me know what you find.
Perhaps I am missing something...when I Build my project in VS2010 I also copy the output to another location. However, the transforms have not taken place at this stage?
If check my bin/release folder, the transforms are there, but the VS Post Build Event has already copied my files?
Two things you should try:
1. Make sure the source file is not marked as Copy to output directory
2. Instead of a post build event create a target in your project file and set the attributes DependsOnTargets="TransformAllFiles" AfterTargets="Build"
We have a number of config files that require transformations across different projects in the same solution.
I've had the idea of creating a config project within the solution that contains the shared config files with their transformations then I would be able to add these config files as linked files into my other projects.
For example the ConnectionStrings node in web/app.config's can use a configSource property which points at the linked file leaving the transformations to be performed by the config project.
Has anyone don the same / can see any potential problems? I also intend to follow Sayed's blog article of integrating SlowCheetah into our solution with solution items so our build server can perfrom the transformations.
Hi. I'm trying to use the same set up that Mike as described to allow a single config file to be shared with several projects, but I cannot get the linked file transformation working. The parent file is always transformed but the linked file isn't. Is there any extra configuration required to transform linked files?
Same here. My app.config transforms fine but the linked file is not transforming.
Preview Transform in the UI shows the transform however it doesn't modify the file in bin\debug after a build.
Running latest build of Slow Cheetah.
I'm probably doing something wrong, but I have an AfterBuild target in my project that copies output files to another directory:
<FilesToCopy Include="$(OutputPath)**\*.*" />
<Copy SourceFiles="@(FilesToCopy)" DestinationFolder="..\..\FitNesse\dll_repository\%(RecursiveDir)" />
However, it would appear that SlowCheetah is actually running the transforms *after* that operation. The result is I get copies of the pre-transformed configs :(
Is there something else I should be doing?
I would like to leverage the technology here to facilitate transformations when installing NuGet Packages. I think the way to do it will be to have a special "exe" that you include in your NuGet Package that is executed by PowerShell once the NuGet is installed. It can be passed various parameters to identify the files to be merged/transformed but missing is the technology to execute the transform outside a build environment.
Any chance you can help there?