Team Foundation Services Binaries folder

2 minute read

In order to add some custom post-build steps to a TFS Build process, it usually comes in handy - might sound as a surprise - to get a hold on the produced output of that build. If you're familiar with Team Foundation Server and the way it deals with the project output, you know I'm talking about the infamous "Binaries" folder where all produced output gets copied to.

Many problems extending the build process find their origin in this rather annoying convention. Imagine for instance you want to create NuGet packages in a post-build step (I already told you it's a bit of a challenge). Let's say you want to target certain *.csproj files with an associated *.nuspec manifest, containing metadata that should get merged with the data NuGet is able to derive from the project. Let's say you want to add some extra files (e.g. a readme.txt, some PowerShell scripts...) to the produced NuGet package. Any idea on how the .nuspec file should look like? Any idea where to point the element at?

Preferably, you'd like to recreate the package on your development machine as well, for testing purposes, without having to redirect the .nuspec file elements, or any MSBuild property involved in these instructions. This is cumbersome to say the least.

Looking at TFServices, it seems that the Binaries folder got relocated. AFAIK the new location of the Binaries folder is the following one: C:\a\bin. However, I can't find any useful documentation on it. Why the 'a' in the path, should we anticipate a 'b' some day? Why not just C:\bin? What's the underlaying folder structure look like, if any? The Binaries path got shortened, which is a good thing! But a little documentation could 've been nice... (and if I can't find it in any search results on page 1, it's not documented IMO).

Edit: As Justin points out in a comment to this post, this is considered an implementation detail and as such undocumented as it isn't part of the public contract. The 'a' stands for 'agent'.

So here's a little gist I produced to scan the Binaries directory (or any directory for that matter), allowing you to investigate its contents in the build logs.

Simply add the following statement anywhere in your MSBuild files where you want the Task to be executed, preferably post-build in the case of the Binaries folder :)

<DisplayBinariesFolder RootFolder="$(OutDir)"/>

And here's the MSBuild task itself:

Hope this helps anyone!

Tags: ,

Updated:

Leave a Comment