Custom SolutionRoot in TFSBuild

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>

1 thought on “Custom SolutionRoot in TFSBuild

  1. download

    Thanks for the good writeup. It in reality was once a entertainment account it.
    Glance complex to more brought agreeable from you!
    However, how can we keep in touch?

Leave a Reply

Your email address will not be published.