How do I put files in the TFS Build drop location
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 t开发者_如何学运维hings into there, or do I alter the TFSbuild.proj in some way to copy the files I want to the drop folder?
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)')" />
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!
精彩评论