How to get path to project in pipleline Azure Devops?

3.9k views Asked by At

I would like to ask how to get path to project (repository) in pipeline (yaml syntax) Azure Devops?

2

There are 2 answers

0
Krzysztof Madej On

You should use $(Agent.BuildDirectory)/s or $(Build.SourcesDirectory) for single repo, but if you use muli repo please check this link

If you have multiple checkout steps in your job, your source code is checked out into directories named after the repositories as a subfolder of s in (Agent.BuildDirectory). If (Agent.BuildDirectory) is C:\agent\_work\1 and your repositories are named tools and code, your code is checked out to C:\agent\_work\1\s\tools and C:\agent\_work\1\s\code.

0
I.sh. On

The $(System.DefaultWorkingDirectory) System-Variable or $(Build.SourcesDirectory) Build-Variable returns the local path on the agent where your source code files are downloaded. (repo root dir)
For example: c:\agent_work\1\s