Search code examples
msbuildslowcheetah

How to transform config files with slow cheetah on build in a web project


So what I want to accomplish is transform all config files on the build.

  • Web.config
  • App.config
  • ....config.xml

In the project files they all look like this:

<None Include="FooBar.config.xml">
  <TransformOnBuild>true</TransformOnBuild>
</None>
<None Include="FooBar.config.Release.xml">
  <DependentUpon>FooBar.config.xml</DependentUpon>
  <IsTransformFile>True</IsTransformFile>
</None>

And everything works fine for windows services and windows applications. But for web projects slow cheetah is not doing the transforms. After some research I found this : "For web projects the files are transformed when you publish or package your application." From the slow cheetah extension page. And indeed when I publish the web project the transforms are done correctly.

So how can I change slow cheetah default behavior and execute all transforms on the build server?

Environment:

  • TFS 2010
  • Slow cheetah version on build server: 1.0.10727.0

Solution

  • So how I fixed this. I've edited the targets file of SlowCheetah

    This can be found C:\Users\BuildUser\AppData\Local\Microsoft\MSBuild\SlowCheetah\v1 On your build server. Open the file and locate the following lines:

    <BuildDependsOn Condition=" '$(IsWap)'!='true' ">
        <BuildDependsOn> 
          $(BuildDependsOn);
          TransformAllFiles
        </BuildDependsOn>
    

    And i've removed the condition.

    Result:

    <BuildDependsOn> 
      $(BuildDependsOn);
      TransformAllFiles
    </BuildDependsOn>