This project is read-only.

How to Create a Team Build for a Project That References Assemblies from Another Project

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

To build a project that has 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 in order to add the assembly or the solution reference and override the BeforeGet event to get assemblies or sources from each of the required team projects.

To build a project that references assemblies in 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 7:13 AM by prashantbansode, version 1


No comments yet.