alexandergs
alexandergs

Reputation: 192

TFS 2017 Build - Customize the "agent_builddirectory" name

in TFS 2017.2 the agent_builddirectory is a consecutive number. I would like to change it to be the Build Definition Name.

How can I achieve that?

Regards!

Upvotes: 0

Views: 209

Answers (2)

Reinhard
Reinhard

Reputation: 36

Most steps of a build execution (e.g. get sources, test assemblies, publish result) are somehow logging their working folder.

By looking at the results of a previously run build you will find out the folder you are looking for.

Upvotes: 0

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30392

No, we cannot customize the “agent_builddirectory” name, unless you reconfigure the agent to change the work folder (create a folder and set the build definition name as the folder name ) before trigger build with the specific build definition.

The alternative way would be create a source folder with the specific build definition name as the folder name on the agent machine.

For example "C:\BuildDefinitionName1" and then add a "Copy Files" task in your build definition to copy the source code from "$(build.sourcesdirectory)" to "C:\BuildDefinitionName1". And then update the settings for other task to run build/test from "C:\BuildDefinitionName1" folder. Make sure to check the "Overwrite" option for "Copy Files" task.

Reference this similar thread: TFS 2015 Build: How to change Agent.BuildDirectory

Upvotes: 1

Related Questions