Passing Visual Studio Team Services build properties to MSBuild
Published 10 March 2016
Visual Studio Team Services (VSTS) doesn't pass the build number and binaries directory as variables to MSBuild by default. If you're using the 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 Use the TFS MSBuild scripts.
If you're using a xaml build:
- In Visual Studio, open your build definition for editing.
- Click Process.
- In the Build process parameters areas, expand the Advanced heading and click in the MSBuild Arguments field.
Paste the following into the field:
/p:tfs_buildNumber=$(Build.BuildNumber) /p:tfs_binariesDirectory=$(Agent.BuildDirectory)
- Press Ctrl+S to save the build definition.
If you're using a vNext build:
- Open your build definition.
- Click Edit and select the MSBuild step
Paste the following into MSBuild Arguments field:
/p:tfs_buildNumber=$(Build.BuildNumber) /p:tfs_binariesDirectory=$(Agent.BuildDirectory)
- Click Save.