kamagra how much to take

Executing (Multiple) Target Injection in TFS

It seems I am never going to be rid of finishing these automating events! One problem that we tackled today dealt with TFS target injection, where you want to call other targets at different points in the build process. An example of this is when you want to wire a target before/after something like SolutionToBuild and ConfigurationToBuild, perhaps to do a little work before the build starts. In this case, the build was chained to **another** build to do a get on a separate VC instance, and build a related solution beforehand. There was also some WIT stuff to be done too.

Fortunately, TFS Build makes this pretty easy through the use of the Before* or After* targets (which are easily grafted from Microsoft.TeamFoundation.Build.targets), most you will ever need are existing but if you need a different one you can use a CallTarget with a MSBuild task. This can get even cooler, because you can actually start to build chained dependencies through something like:

  1. <Target Name="BeforeCompile" DependsOnTargets="CustomTarget" />

Pretty neat!

Share

2 Comments

  1. Daniel says:

    I think a cleaner way to inject custom targets into the build process is by using/adding items to the respective PropertyGroup definitions:

    from any .targets/.msbuild file, you can just inject a new item into an existing PropertyGroup-definition, for example:

    $(BuildDependsOn);
    MyCustomTarget;

    The Target MyCustomTarget will then be invoked for any targets that reference the BuildDependsOn group.

    This works for any group and for TFS Team Builds as well as local builds with visual studio/msbuikd. No need to touch or change any vendor files.

  2. Daniel says:

    Whoops, my first posting missed the encoding of the markup:

    I think a cleaner way to inject custom targets into the build process is by using/adding items to the respective PropertyGroup definitions:

    from any .targets/.msbuild file, you can just inject a new item into an existing PropertyGroup-definition, for example:

    <PropertyGroup>
    <BuildDependsOn>
    $(BuildDependsOn);
    MyCustomTarget;
    </BuildDependsOn>
    </PropertyGroup>

    The Target MyCustomTarget will then be invoked for any targets that reference the BuildDependsOn group.

    This works for any group and for TFS Team Builds as well as local builds with visual studio/msbuikd. No need to touch or change any vendor files.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>