Team Foundation Build Recipes
Navigation
Main Page
Browse Recipes
Add New
Request a Recipe
Login/Logout
Create Account
All Pages
Categories
File Management
Your Profile
Administration
Quick Search
Advanced Search »
Back
History
Copying Files from Drop or Similar Type Location
===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. ===Usage=== Add to TFSBuild.proj as an override of the AfterGet target ===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] ====Script==== @@ <Target Name="AfterDropBuild"> <!-- I just do the below as a matter of form and practice for easier maintenance if the property is referred to in multiple locations in this target --> <CreateProperty Value="\\mymachine\Drop\$(BuildNumber)"> <Output TaskParameter="Value" PropertyName ="MyDropLocation"/> </CreateProperty> <!-- notice I also don't use *.* in the include but * so that I pick up any files without an extension as well - this may or may not be what you desire--> <CreateItem Include="$(DropLocation)\$(BuildNumber)\**\*"> <Output TaskParameter ="Include" ItemName ="MyDropFiles"/> </CreateItem> <Copy SourceFiles="@(MyDropFiles)" DestinationFiles="@(MyDropFiles->'$(MyDropLocation)\%(RecursiveDir)%(Filename)%(Extension)')"/> </Target> @@ ===Notes===
© 2008 William Bartholomew
blog.bartholomew.id.au
Powered by
screwturn wiki