Monday, August 11, 2008

Microsoft.Sdc.Tasks

I just discovered this collection of MSBuild tasks. There are tasks for all kinds of things you might want to do during your build including...

  • Editing XML files using XPath
  • Setting up web sites including creating virtual directories
  • Editing registry settings
  • Setting version numbers
  • Lots of file and folder manipulation

... and lots more. I'm using its XmlFile task for changing my NHibernate-Windsor-integration IsWeb setting to false in the windsor.config file that's copied to my tests project:

<Target Name="AfterBuild">
<Copy
   SourceFiles="$(SolutionLocation)MyProject\Configuration\Windsor.config"
   DestinationFiles="$(TargetPath).Windsor.config"
   />
<Copy
   SourceFiles="$(SolutionLocation)MyProject\Web.config"
   DestinationFiles="$(TargetPath).config"
   />
<XmlFile.SetAttribute
           Path="$(TargetPath).Windsor.config"
           XPath="/configuration/facilities/facility[@id='nhibernate']"
           Name="isWeb"
           Value="false"
           IgnoreNoMatchFailure="false"
           Force="true"
   />
</Target>

No comments: