What is `build agent folder` $(SourceDir) of a build definition in TFS Build 2012?
Asked Answered
B

2

36

When creating a build definition for a TFS build, there is a section called Source Settings as below snapshoot where we have to define 1) Source Control Folder and 2) Build Agent Folder.

As I understand, the source control folder is where to get the source to build. But I don't get the idea what is the build agent folder is used for in a build.

Please share me what that is about if you know it. Thank you!

enter image description here

Brig answered 22/11, 2013 at 7:48 Comment(3)
Directory on the Build machine , which will be used for "check out" your source code from TFS , Compiled and BuildTips
@SurjitSamra And what does $(SourceDir) mean then?Brig
Added my answer, hopefully it will helpTips
T
31

$(SourceDir) is the Directory on the Build machine, which will be used for Check-out your source code from TFS and then to Compile it and Build.

Value for the $(SourceDir) is what you will configure it to; normally your working directory on the build machine and by default its value come from Working directory settings on the build agent properties (red marked) option as shown in the picture; i.e. $(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)

Where

  • $(SystemDrive) is system drive, e.g. C:
  • $(BuldAgentID) is a numeric number assigned to agents normally 1,2,3 etc.
  • ($BuildDefinitionPath) is the root folder of your source code from TFS.

So a typical example of $(SourceDir) can be "C:\Bulids\1\TeamProjectName\Path\To\Your\App"

enter image description here

enter image description here

Tips answered 2/12, 2013 at 17:10 Comment(2)
I got that. Please combined your answer into a full-detail one so as I get yours as accepted. Thank you!Brig
$(SourceDir) does not exist in TFS 2015, found $(Build.SourcesDirectory) instead.Gish
V
4

Build Agent host WWF (sequential workflow) and execute all activities on source.

When you set Build Agent Folder to $(SourceDir), agent use Working Directory in order to retrieve source.

When you set Agent Folder to another folder, agent retrieve source from this folder

Vaccination answered 22/11, 2013 at 13:56 Comment(1)
To retrieve the source? I guess source retrieve trong the source control folderBrig

© 2022 - 2024 — McMap. All rights reserved.