1

I am using Slow Cheetah to transform app.config file for a console app. During build I also invoke this application. Initially I used post-build event, but then I realized that Slow Cheetah transforms run after post-build events, so I used solution as explained here:

SlowCheetah executes after post-build events

So basically, in my Migrations project I have following section (Echo / Type for diagnostics)

<Target Name="AfterBuild" AfterTargets="TransformAllFiles">
    <Exec Command="Echo $(OutputPath)" />
    <Exec Command="Type $(OutputPath)Migrations.exe.config" />
    <Exec Command="$(OutputPath)Migrations.exe" />
</Target>

This works great locally. However when deployed to CI server (CruiseControl + MSBuild 4.0), I observe weird behavior. Those tasks now run "before" Slow Cheetah. To verify I 'type' config file, and I can see that it was not transformed. However once build is complete and I go to build box, I see already converted file in the same location.

So Slow Cheetah is doing its job, but for some reason after those tasks run. Any suggestions how this could be resolved?

1 Answer 1

3

Ok, So I figured it out. Turns out, it wasn't working locally either. Its just in VS 2010 IDE i did not run clean build every time, so it was picking up already transformed file.

To troubleshoot it I ended up running MSBuild command-line, and when I did that I noticed that the last target run was ScReplaceAppConfigItem. I tried to use AfterTargets to force my tasks to run after but it did not help. My tasks still run before.

What made it work, was actually using older DependsOnTargets attribute:

<Target Name="AfterBuild" DependsOnTargets="ScReplaceAppConfigItem">
  <Exec Command="Echo $(OutputPath)" />
  <Exec Command="Type $(OutputPath)Migrations.exe.config" />
  <Exec Command="$(OutputPath)Migrations.exe" />
</Target>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.