In this article, I would like to share my learnings about the directory structure of Azure pipeline Microsoft-hosted agents. This code sample includes the ready-to-use Azure pipelines with
Azure Pipelines have predefined variables which you can use on your pipelines. There are different directory variables, some of which overlap, some of them are under a different partition. I am trying to describe those predefined variables below.
windows-2019 (Microsoft-hosted agent)
Agent.TempDirectoryare used for different versions of tools.
C:and then tools are cached and not cleaned up across the pipeline runs.
D:and then cleaned up after a pipeline run. The code example below lets the pipeline use the cached versions of .NET 6 tools.
- task: UseDotNet@2 displayName: Use .NET 6 sdk inputs: packageType: sdk version: 6.0.x installationPath: $(Agent.ToolsDirectory)/dotnet
D:\a\1which is a workspace directory for a particular pipeline.
D:\a\1\a, which is used for where build artifacts are copied before being pushed.
D:\a\1\b, which is used for compiled binaries.
D:\a\1\a, which are used for your source code files.
dotnet restore creates
obj folder and includes some of files regarding Nuget packages.
dotnet build outputs dll files and exe files under
dotnet publish outputs dll files and exe files under a pointed folder. For example, the code example outputs files under
publish folder and then those files are zipped. In this case, the project name is
TravelApi and the zip file name is
TravelApi.zip, which is used for Azure App Service deployment. The difference from
dotnet build is
web.config in addition to the build files.