This project is read-only.

How to Build a Project with Dependencies on Another Team Project

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

Team Build does not support building solutions that cross team projects. To enable this, you must customize the TFSBuild.proj file to check out the code you need from the other projects on which your build depends.

To build a project with dependencies on another team project, you need to get the source or assemblies from that project into the workspace on your build server. To do this, you need to edit your TFSBuild.proj file to add the assembly or the solution reference and override the BeforeGet event to get assemblies or sources from each of the team projects on which you have a dependency.

To build a project that has dependencies on another team project
  • Check out the TFSBuild.proj** script from Source Control Explorer.
  • Add the following configuration setting under the PropertyGroup section:
<!-- to be added under PropertyGroup -->

SkipInitializeWorkSpace allows you to skip invoking the default tasks to delete and re-create the workspace on the build machine. The new property is used in the custom target BeforeGet (see below).
  • Add the following configuration setting to the ItemGroup entries that map both the Team Projects and the solutions. Make sure that you provide the correct local paths for the build machine. Multiple mappings cannot share the same local folder and will result in a MappingConflictException exception in the CreateWorkspace task.
  <!-- add one entry for every solution you reference -->
  <SolutionToBuild Include="$(SolutionRoot)\DependentApp\DependentApp.sln" />
  <SolutionToBuild Include="$(SolutionRoot)\YourApp\YourApp.sln" />

  <!-- add one entry for every Team Project you reference -->
  <Map Include="$/YourApp/YourApp">
  <Map Include="$/DependentApp/DependentApp">
  • Override the BeforeGet event to retrieve the workspaces for each Team Project:
<Target Name="BeforeGet">
      Name="$(WorkspaceName)" />
    Command="&quot;$(TfCommand)&quot; workspace /new $(WorkSpaceName) /server:$(TeamFoundationServerUrl)"/>
   Command="&quot;$(TfCommand)&quot; workfold /unmap /workspace:$(WorkSpaceName) &quot;$(SolutionRoot)&quot;"/>
    Command="&quot;$(TfCommand)&quot; workfold /map /workspace:$(WorkSpaceName) /server:$(TeamFoundationServerUrl) &quot;%(Map.Identity)&quot; &quot;%(Map.LocalPath)&quot;"/>
  • Check in the build script and run the build.

Additional Resources

Last edited Jul 26, 2007 at 6:57 AM by prashantbansode, version 1


No comments yet.