Support for web publish profiles #46

sayedihashimi opened this Issue Nov 9, 2012 · 12 comments

4 participants


Web projects now support transforms based on the publish profile, SlowCheetah should respect this for files other than web.config.

@sayedihashimi sayedihashimi was assigned Nov 9, 2012

There is two aspects to this:
1. Support for to transform the when the web project is packaged/published
2. UI support to add profile specific transforms when the Add Transform command is invoked

I'll most likely deliver them separately with the UI support coming after the build support.

The build support will be implemented in the same way that web.config transforms are applied.

file.conifg -> file.{BuildConfig}.config -> file.{Profile}.config

If the transform files are missing obviously they will simply be skipped.

@sayedihashimi sayedihashimi added a commit that referenced this issue Nov 10, 2012
@sayedihashimi Update to support web publish profiles. Added sample as well. Still n…
…eed to add tooling support in VS. Related to issue #46

OK I have a fix for the underlying build/publish support. Can you try it out? Follow these steps:
1. Close all instances of VS both 2010 and 2012
2. Copy the file from to C:\Users{USERNAME}\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1

Since I have not added support for the UI in VS yet you'll have to add the file to the project manually. Do that by the following.
1. Create the file in the correct location
2. Open the project file (.csproj/.vbproj) in an editor (if you use VS just chose File->Open File)
3. Locate the build config transforms in the proj file by searching for the file name
4. Copy the element and replace the Include value to the publish profile specific file name. For example:

<None Include="connectionStrings.ToPkg.config">

You can see how I did this in the samples at

After that publish/package your web project and see if the transform is applied.

Can you let me know what you find out?


Sure, no problem. I'll let you know what I find.


So I did the following:

  1. Closed all VS instances
  2. Backed up the SlowCheetah.Transforms.targets in C:\Users<login>\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1
  3. Copied the file at the dropbox link to the same folder, and named it SlowCheetah.Transforms.targets
  4. Edited the csproj for the test web project (the one we sent you previously). We already had transform files added for a couple of publish profiles so the syntax for the transform file in the csproj was already pretty much what you describe, except I had to add Designer... (not sure if that matters)
  5. Open the project in VS2012
  6. Right Click --> Publish, selected the publish profile (ColorWebPublishZip), selected WebDeployPackage as the publish method
  7. Inspected the generated ZIP file and found the AppSettings.config does not contain the changes
    for the publish profile, it does however contain the Release transform settings.

Same applies to the ConnectionStrings.config transforms.

So I double checked everything, only difference between my csproj and the one you posted here was the transform deltas in your examples were in separate ItemGroup to the file they were dependent on. So I moved the AppSettings transform files into a separate itemgroup and tried again. Same result.

I have send you a copy of the project, the package created by the publish command and the targets file I have in my SlowCheetah\v1 folder just in case.

Perhaps I'm missing something somewhere?

Let me know if you want me to try something else.


It looks like its working on my machine. Let me finish up the support and I'll create a new VS extension which you can try out. I think one of the manual steps is what is likely to be the culprit here.


OK I think I got it figured out. Can you uninstall SlowCheetah and then re-install from and let me know if it works for you. I now have the tooling to create the publish profile specific transforms so no editing of the .csproj required.

Technical notes
I was just testing from the command line and I was using the PublishProfile property. This property is not passed in via the UI. Instead WebPublishProfileFile is passed in and it contains the full path to the profile. Using PublishProfile should be avoid in any case because it can be either a profile name or a full path so WebPublishProfileFile is better because it will always have a full path.


Tested using the attached vsix/zip, both AppSettings and Connectionstring config files are transformed successfully based on a publish profile! Also, transforms appear to be chained correctly where a build config (release) transform is applied followed by a publish profile transform.

Awesome! We'll start using this immediately. Thanks Sayed for implementing this so quickly, much appreciated!


Works like a charm, awesome!


OK cool, I will close this item. The feature will be included in the next release. I'm not sure when that will be but the vsix in the link above will stay there for anyone who needs it.


Is there any way to turn this feature off? Every time I generate a new transform for a solution config I have to clean up dozens of unwanted 'profile' transforms that someone seemed to think we wanted. It's been driving me bananas. I just want an option to kill a feature which tests my sanity at least once a month. There are already some options for Slow Cheetah, maybe one more makes sense. Also, this does not behave like Visual Studio's web.config support for creating transforms, VS does not create a bunch of 'publish' transforms, and SlowCheetah does nothing to change that behavior. There's a difference between "supported" and "promoted by tooling", this exposes something that was in no way originally "promoted by tooling" (again, VS doesn't do this for web.config.)


@wilson0x4d You sound a bit arrogant imo...


Hi @wilson0x4d thanks for the comments.

I'm aware of how the web.config profile transforms work, I designed that feature :) It doesn't make sense to compare the SC "Add Transform" command to the web.config profile. In the web.config profile transform case you right click on the publish profile (i.e. myprofile.pubxml) and then the transform (web.myprofile.config) is created for web.config. So there is a 1:1 relationship between the profile and the transform. In the SlowCheetah case you can transform any file, not just web.config or app.config. So there is no way of knowing which file(s) to create the transforms for.

While developing the feature I saw the following high level options.

  1. Create transforms for each publish profile
  2. Have the user select which profile(s) to create transforms for

The assumptions that I had were the following.

  1. Most projects will have a small set of publish profiles (~3)
  2. If you transform values for one profile odds are you want to transform that same value in other transforms

Based on that I chose the first option, to create transforms for each publish profile. For the case where the user does not want those transforms they can simply delete them.

Unfortunately the tool is not optimized for your case. I apologize for that. I'm not developing these features for any specific person, but for the most commonly used case.

You are the only person who has requested this feature so I do not believe there is enough interest for me to prioritize this. You could create a new entry at to see how many others are interested in it. Or you could send me a pull request with the implementation. If the code quality is good I will certainly process the PR. The code that you need to update is at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment