Tech Dreams

Team Foundation Server – How to pass ReferencePath argument to MSBuild

When we manually build a .NET project using Visual Studio, the reference paths set in Project Properties are picked up by Visual Studio for referring to dependent DLLs. But the project is built using TFS, the reference path’s specified in project properties are not considered. This is because Reference Paths are user specific settings and they are not stored in .proj files(they are stored in user settings files). The TFS build may break if it does not find the required DLLs in GAC. We can solve the problem by passing ReferencePath parameter to MSBuild in TFS build configurations.

  1. Go to Team Explorer
  2. Select Build Defintion >> Edit Build Definition
  3. Switch to Process tab
  4. Navigate to Advanced Section and locate MSBuild Arguments
  5. Add the following: /p:ReferencePath=”{File path}”

tfs_specifying_msbuild_reference_path