Search code examples
powershellbuildenvironment-variablestfsbuildbin

Is there any TFS environment variable to know the "bin" folder path in build definition?


For example, there is TF_BUILD_SOURCESDIRECTORY environment in TFS which we can use in Post-build Powershell scripts to know the sources directory (where TFS has dumped the source code at build server during build). That means, this can return us something like - "C:\Builds\3\MyProject\MyApplication.UAT\src"

Now, I would like to know the location of "bin" folder (which usually will be - "C:\Builds\3\MyProject\MyApplication.UAT\bin" in above case). I can always predict that using string replacements, but I would prefer to use Environment variable if there is any.

Do anyone know the environment variable to get the "bin" folder path in build definition?


Solution

  • Ok, I found it myself from a bit more research on MSDN..

    there is an environment variable for this in TFS named as - "TF_BUILD_BUILDDIRECTORY". This variable can be used in TFS build (post-build or pre-build powershell scripts) to know the location of build folder on build server