May 6, 2011

Specifying Reference Paths in TFS 2010 build definition

While creating build definition using TFS 2008, we could specify the path(s) where the build server could look for the references. This was of great help as it avoided installing dependent assemblies in the GAC in the build server.
It was easily done by editing the project file and adding <AdditionalReferencePath> element.

In Team Foundation Server 2010, the build definition are workflow based and if you are creating any build definition using default template, there is no option to specify the additional reference paths.

Since, new template also supports the msbuild arguments, we have to specify the reference path as a build argument. For this we have to add "ReferencePath" as property to the msbuild arguments.

Go to Team Explorer >> Build Defintion >> Edit Build Definition >> Process >> Advanced Section >> MSBuild Arguments and Add the following: /p:ReferencePath=”{File path}”

We can specify multiple reference paths separated by ';'

2 comments:

  1. It would be more helpful if you can explain by example about the MS argument to be given in Build definition. to provide the reference path to our project.

    ReplyDelete
  2. Trupti, if your project has references to external libraries which are not in GAC, then you can save these dlls somewhere in share drive and you can give the path as build parameter. Whenever you trigger a build, TFS server will look for these DLLs in that specified path.

    Let's just say if you are storing these dlls in a network share \\file-server\buildreferences and you would like to use these dlls in your build definition "BuildDefinition1", then you have to go to
    Team Explorer >> Build Defintion >> Select BuildDefinition1 >> Edit Build Definition >> Process >> Advanced Section >> MSBuild Arguments
    and specify the value as /p:ReferencePath=”\\file-server\buildreferences”

    Hope it's clear.

    ReplyDelete