Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I put files in the TFS Build drop location

Tags:

tfs

tfsbuild

I'm new to using TFS build. I've got a build defined that runs as a continuous integration. It creates a drop folder, but there's nothing in it.

What's the best practice for moving stuff in the drop folder? I've seen a Binaries folder, do I need to copy things into there, or do I alter the TFSbuild.proj in some way to copy the files I want to the drop folder?

like image 355
Scott Langham Avatar asked Oct 14 '22 06:10

Scott Langham


2 Answers

It sounds like you want to copy miscellaneous files from your workspace (or elsewhere) into the drop location?

The target above gives you an example of how to create a target to copy files, but you're probably wondering how to hook it up in your TFSBuild.proj.

A simple way to do this is using one of the pre-defined skeleton targets for this such as AfterDropBuild. If you had a target like the one mentioned above for copying your files you would put this in TFSBuild.proj:

<CreateItem Include="$(SolutionRoot)\Source\RandomFilesInWorkspaceFolder\**\*.*">
  <Output TaskParameter="Include" ItemName="RandomFiles" />
</CreateItem>
<Copy SourceFiles="@(RandomFiles)" DestinationFiles="@(RandomFiles->'$(DropLocation)\RandomDestinationSubFolder\%(RecursiveDir)%(Filename)%(Extension)')" />
like image 78
Brandon Hawbaker Avatar answered Oct 19 '22 10:10

Brandon Hawbaker


I seemed to get it working by adding this near the end of my TFSBuild.proj

<Target Name="PackageBinaries">
    <ItemGroup>
        <FilesToDrop Include="$(SolutionRoot)\MyProduct\Installer\Bin\**\*.msi"/>
    </ItemGroup>
    <Message Text="FilesToDrop=@(FilesToDrop)"/>
    <Copy SourceFiles="@(FilesToDrop)"
      DestinationFiles="@(FilesToDrop ->'$(BinariesRoot)\%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>

It copies wanted msi files into the Binaries folder which the normal tfs build system then copies to the drop location. I noticed the Binaries folder gets deleted everytime a build is started, so you don’t have to worry about cleaning up.

The PackageBinaries target seems to be the standard target name that you can override for doing this kind of thing.


Update Newer versions of TFS probably have better ways!

like image 34
Scott Langham Avatar answered Oct 19 '22 10:10

Scott Langham