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

JCisar picture JCisar · Sep 22, 2017 · Viewed 10.3k times · Source

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?

Answer

jessehouwing picture jessehouwing · Sep 22, 2017

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