views:

33

answers:

1

I seem to have a situation where code that I put into the BeforeBuild target is not successfully executing.

Here is what I have:

<Target Name="BeforeBuild" >
    <Message Text="Before Build" />
</Target>

I can’t see the message output in the build log when the build runs. Is there something wrong with the way I’ve formatted this, or does it have to be in a specific place in the script? Am I even looking in the correct place for these messages?

EDIT: changing the importance to high seems to make no difference

A: 

You need to properly override the Before build target. The easiest way to do it is to insert the override before tag, or declare this task as DefaultTargets.

<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
    <!-- Override TFS build targets and run custom made ones -->
  <Target Name="BeforeCompile" DependsOnTargets="VersionAssemblies"></Target>
  <Target Name="AfterCompile" DependsOnTargets="GetTime;RunTests;CreateHTMLReport;Mail"></Target>
  <Target Name="AfterDropBuild" DependsOnTargets="RemovePrevContent;CopySrcBinaries;ZipBinPackages;CopyAllContent;RemoveBindings"></Target>

</Project>
Leszek Wachowicz
When I override BeforeCompile, it works. But overriding BeforeBuild does not. Specifying DefaultTargets doesn't seem to matter - if there's something in the .proj file for the solution, it seems to use that as a preference.
pm_2