Home > Code > Custom SolutionRoot in TFSBuild

Custom SolutionRoot in TFSBuild

June 29th, 2009

So I’m working through an issue trying to copy the build results from the local build location on the build machine to the drop location. I need to to do this manually because I need my solution to be built exactly the way it is built from the IDE, to keep file references in tact. This should be simple, right? Wrong. It seems that the $(SolutionRoot) property is not set to the value of Local Folder in your build definition. The value for $(SolutionRoot) does not seem to affected by customizing this value.

A simple work around to this is to use the $(Solution) property instead, it actually provides the location of the sln file itself. So with a bit of manipulation we can gather our real solution root location. Here is an example of how we can manipulate the value provided by $(Solution) to get the actual solution root.

<Target Name="AfterCompileSolution">
    <ItemGroup>
        <SolutionOutputs Include="$(Solution)\..\**\*.*" />
    </ItemGroup>

    <Copy SourceFiles="@(SolutionOutputs)" DestinationFolder="$(DropLocation)\$(BuildNumber)\%(Directory)%(RecursiveDir)" ContinueOnError="true" />
</Target>
  • Facebook
  • Twitter
  • Delicious
  • Reddit
  • StumbleUpon
  • Share/Save/Bookmark
Author: Categories: Code Tags: ,
  1. No comments yet.
  1. No trackbacks yet.