The default TFS drop folder scheme is a train-wreck where all the binaries and output files from the entire solution are summarily dumped into a single folder (albeit with some special-case handling for websites). Its just gross.
What I wanted, of course, was a series of folders by project containing only the build artefacts relevant for that project: ‘xcopy ready’ as I like to say. Pretty sensible yes? Quite a popular request if one Googles around: one wonders why the train-wreck scheme was implemented at all. But I digress.
Contrary to what you (and I) may have read, you actually have to do this using AfterBuild, not AfterCompile (which fires way too early in the build process). So the canned solution is:
Put this in your TFSBuild.proj:
<!-- TEAM PROJECT
(this turns off the ‘train-wreck’ scheme, and goes back to each project’s output going to their bin\debug or whatever folder)
Put this in any project file that you want to capture the output from:
<Target Name="AfterBuild" Condition=" '$(IsDesktopBuild)'!='true' ">
<Message Text="Copying output files from $(OutDir) to $(TeamBuildOutDir)" />
<FilesToCopy Include="$(OutDir)\**\*.*" />
<Copy SourceFiles="@(FilesToCopy)" DestinationFiles="@(FilesToCopy ->'$(TeamBuildOutDir)\$(AssemblyName)\%(RecursiveDir)%(Filename)%(Extension)')" />
And hey presto:
A series of output folders, by assembly, containing only the artefacts relevant to that assembly, as opposed to the
Note however that with this scheme you get all files marked ‘Copy to Output Directory’ but not files marked as Content, which makes this currently unusable for deploying websites and means it’s not strictly speaking xcopy-ready. Hopefully there is an easy fix to this, otherwise I’ll be diving back into the SNAK codebase where I’ve solved this previously.
 before serialization assemblies are generated, and before the obj folder has been copied to the bin folder. A good diagnostic is to put <Exec Command="dir" WorkingDirectory="$(OutDir)"/> into an AfterCompile target, and take a look at what you get back.
 I have a big thing about this, which is why I dislike the ClickOnce build output so much. Build and deploy need to be considered separately.