Search code examples
tfsbuild-process

TFS Build GetBuildDirectory and Store it


I'm trying to get a TFS current build directory path but it's not working. I've tried this:

Microsoft.TeamFoundation.Build.Activities.Extensions.WellKnownEnvironmentVariables.BuildDirectory

I see it printing right path with "GetBuildDirectory" Step (in the diagnostics log), but How would I store this information into a variable?

enter image description here

ANSWER: enter image description here


Solution

  • There have been TF_BUILD environment variables.You can use the TF_BUILD environment variables to get key bits of data that you need for your build process logic. More from MSDN: Team Foundation Build environment variables

    You could just reference the TF_BUILD_BUILDDIRECTORY to get The build agent working directory. For example: C:\Build\BuildBot3\CoolApp\CIBuild.