Condividi tramite


The CompilationOutputs Item Group

I've mentioned the CompilationOutputs item group we added in TFS 2008 before in passing (see this post, for example), but never given it the attention it deserves...  This item group is built up over the course of the Compile / CompileConfiguration / CompileSolution targets, and by the end of the build it contains the full list of outputs generated by all the items in your SolutionToBuild item group.  Furthermore, it includes metadata that allows you to distinguish the outputs for each platform/configuration pair and for each individual solution.  For example, given solutions Foo.sln and Bar.sln and configurations x86|Debug and x86|Retail, the following target:

   <Target Name="AfterCompile">
    <Message Text="%(CompilationOutputs.Solution) built %(Identity) for %(Platform)|%(Configuration)." /> 
  </Target>

...might produce the following output:

   C:\BuildLocation\TeamProject\Definition\Sources\Foo.sln built C:\BuildLocation\TeamProject\Definition\Binaries\x86\Debug\Foo.exe for x86|Debug.
  C:\BuildLocation\TeamProject\Definition\Sources\Bar.sln built C:\BuildLocation\TeamProject\Definition\Binaries\x86\Debug\Bar.exe for x86|Debug.
  C:\BuildLocation\TeamProject\Definition\Sources\Foo.sln built C:\BuildLocation\TeamProject\Definition\Binaries\x86\Release\Foo.exe for x86|Release.
  C:\BuildLocation\TeamProject\Definition\Sources\Bar.sln built C:\BuildLocation\TeamProject\Definition\Binaries\x86\Release\Bar.exe for x86|Release.

Of course, producing that output is not particularly exciting.  It is easy to imagine lots of other cool things that can be done with this information, however, including copying all build outputs to the drop location without putting them in the default build location (where they all end up in a single folder).  I'm sure users of Team Build will come up with lots of other creative uses for this item group as well.

Comments

  • Anonymous
    August 08, 2008
    PingBack from http://blog.a-foton.ru/2008/08/the-compilationoutputs-item-group/
  • Anonymous
    August 12, 2008
    Anthony Borton on AVG 8 causes TF31002 errors The Visual Studio Profiler Team Blog on Walkthrough: Profiling...
  • Anonymous
    August 15, 2008
    Great blog - thanks for your great effort. Please check out my blog post on how to speed up team build using multi processes:http://riskresolution.spaces.live.com/blog/cns!8E06D0A06D7890AA!246.entryTom
  • Anonymous
    July 15, 2010
    I know this is an ancient post, but I have been searching MSDN and the web, and I cannot seem to find any equivalent to this in TFS 2010 workflow build. Can someone provide me with any direction on this?