SQL Automation Pack

Passing TFS Build properties to MSBuild using TFS 2013, 2012 and 2010

TFS does not pass the build number and binaries directory as variables to MSBuild by default. If you're using the TFS MSBuild scripts, you'll need to follow the manual steps described here to avoid builds failing. 

You must also follow the configuration steps described in Using the SQL CI TFS MSBuild scripts or Using the SQL CI TFS MSBuild scripts (v1.0.4.2 and earlier).

Passing TFS 2013 build properties to MSBuild

If you're using SQL Automation Pack v.1.1.0.1765 and later:

  1. Open your build definition for editing and click Process.
  2. In the Build process parameters areas,  go to Advanced > MSBuild Arguments and click in the text box.
  3. Paste the following:

    /p:tfs_buildNumber="$(TF_BUILD_BUILDNUMBER)" /p:tfs_binariesDirectory="$(TF_BUILD_BINARIESDIRECTORY)"
  4. Press Ctrl+S to save the build definition.

If you're using SQL Automation Pack v1.0.4.2 and earlier, follow the instructions below for enabling in TFS 2012 and 2010, and choose your SQL Automation Pack version at step 4. 

Passing TFS 2012 and 2010 build properties to MSBuild

Edit the build process XAML file used in your build.

  1. To find the path for your build process file in Source Control, open your build definition for editing and click Process:


    The source control path for the file is displayed.
  2. Open this file in a text editor.
  3. Find any occurrences of the element:

    "[String.Format("/p:SkipInvalidConfigurations=true {0}", MSBuildArguments)]"
  4. Follow the instructions for the SQL Automation Pack version you're using:

    • If you're using SQL Automation Pack 1.0.4.2 and earlier, replace every occurrence with:
    "[String.Format("/p:SkipInvalidConfigurations=true /p:BuildNumber={1} {0}", MSBuildArguments, BuildDetail.BuildNumber)]"
    • If you're using SQL Automation Pack 1.1.0.1765 and later, replace every occurrence with:
    "[String.Format("/p:SkipInvalidConfigurations=true /p:tfs_binariesDirectory=""{2}"" /p:tfs_buildNumber={1} {0}", MSBuildArguments, BuildDetail.BuildNumber, BinariesDirectory)]"
  5. Commit the edited XAML file to source control.

If you're using SQL Automation Pack 1.0.4.2 and earlier, you'll also need to open your sqlCI.targets file, and in the Build number section, type $(BuildNumber) 


Didn't find what you were looking for?