Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between $(Build.Repository.LocalPath) and $(Build.SourcesDirectory) in TFS Build Online 2017

I am trying to figure out if there is a difference between the two pre-defined variables in TFS Online 2017: $(Build.Repository.LocalPath) and $(Build.SourcesDirectory). I have a build that uses these two variables and didn't know if I could use them interchangeably or not.

Looking at Microsoft's documentation the descriptions are as follows:

$(Build.SourcesDirectory): The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s By default, new build definitions update only the changed files. You can modify how files are downloaded on the Repository tab.

$(Build.Repository.LocalPath): The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s By default, new build definitions update only the changed files. You can modify how files are downloaded on the Repository tab.

Are these representing the same thing or am I missing something?

like image 895
JCisar Avatar asked Sep 22 '17 18:09

JCisar


2 Answers

They're synonyms. Most standard templates and tasks use the $(Build.SourcesDirectory), so that is what I tend to use.

like image 104
jessehouwing Avatar answered Dec 01 '22 00:12

jessehouwing


They often result in the same but not necessarily. As described in the docs:

If you check out multiple repositories, the behavior is as follows (and might differ from the value of the Build.SourcesDirectory variable):

The description for Build.SourcesDirectory on the same page contains a similar note.

Basically if you want to define a custom path for the self checkout and still not need to specify the extra dir, you specifically need Build.Repository.LocalPath.

like image 30
insideClaw Avatar answered Nov 30 '22 23:11

insideClaw