Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 232
Preben Huybrechts Avatar asked Feb 07 '14 08:02

Preben Huybrechts


People also ask

How do I convert web config?

In Solution Explorer, right-click Web. Release. config and click Preview Transform.

How do you put a slow cheetah in?

Step 1: Install the package "Slow Cheetah" into your solution. Step 2: Right click on the App. config and select the option Add Transform. Step 3: To tweak the appsetting values ,connection strings etc based on the configuration environement.


1 Answers

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>
like image 166
Preben Huybrechts Avatar answered Sep 18 '22 12:09

Preben Huybrechts