Team Foundation Build Recipes

Copying Files from Drop or Similar Type Location

Modified: 2008/02/24 01:07 by michaelruminer - Uncategorized
Edit

Description

It's very common that someone will want to create a build Item that is expected to consists of the output files, such as those in OUTDIR or DropLocation, and then at some point near the end of the script using that Item in for copying those files to some other location. Commonly people find that they ended up with an empty directory at this new target location and are a bit perplexed as to why.

This script should wok for you. See the source section below for a more detailed description and additional references including a bit of sample code often seen that people use that doesn't work as expected.

Edit

Usage

Add to TFSBuild.proj as an override of the AfterGet target

Edit

Source

Micael Ruminer's blog entry among likely countless other locations contains this information http://manicprogrammer.com/cs/blogs/michaelruminer/archive/2008/02/23/teambuild-outdir-item-expansion-and-why-your-copy-task-gave-you-nothing.aspx

Edit

Script

 
   <Target Name="AfterDropBuild">
     
      
        <CreateProperty
              Value="\\mymachine\Drop\$(BuildNumber)">
             <Output
                 TaskParameter="Value"
                 PropertyName ="MyDropLocation"/>
         </CreateProperty>
       
      
         <CreateItem
              Include="$(DropLocation)\$(BuildNumber)\**\*">
              <Output
                 TaskParameter ="Include"
                 ItemName ="MyDropFiles"/>
         </CreateItem>
    
        <Copy
            SourceFiles="@(MyDropFiles)" 
            DestinationFiles="@(MyDropFiles->'$(MyDropLocation)\%(RecursiveDir)%(Filename)%(Extension)')"/>
   </Target>



Edit

Notes

© 2008 William Bartholomew blog.bartholomew.id.au

Powered by screwturn wiki