<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sharlene D'Silva</title>
    <description>The latest articles on DEV Community by Sharlene D'Silva (@shleeen).</description>
    <link>https://dev.to/shleeen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F425248%2F78fc96ae-2bb3-4dd2-bc0b-78b2d0cffac6.png</url>
      <title>DEV Community: Sharlene D'Silva</title>
      <link>https://dev.to/shleeen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shleeen"/>
    <language>en</language>
    <item>
      <title>Understanding the directory structure created by Azure DevOps tasks.</title>
      <dc:creator>Sharlene D'Silva</dc:creator>
      <pubDate>Tue, 29 Sep 2020 23:35:52 +0000</pubDate>
      <link>https://dev.to/shleeen/understanding-the-directory-structure-created-by-azure-devops-tasks-1328</link>
      <guid>https://dev.to/shleeen/understanding-the-directory-structure-created-by-azure-devops-tasks-1328</guid>
      <description>&lt;p&gt;As a beginner in all things Azure DevOps, understanding when folders are created and populated by the pipeline tasks is the first step to learning how to manipulate it to suit your needs. &lt;/p&gt;

&lt;h4&gt;
  
  
  The YAML
&lt;/h4&gt;

&lt;p&gt;Using Visual Studio I created an ASP.NET based project (named TestApplication). The YAML file shown below was the template created by Azure DevOps, following &lt;a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops&amp;amp;tabs=net%2Cyaml%2Cbrowser%2Ctfs-2018-2" rel="noopener noreferrer"&gt;this&lt;/a&gt; tutorial. However, the &lt;em&gt;VSBuild@1&lt;/em&gt; task was modified using &lt;a href="https://stackoverflow.com/questions/50495038/msbuild-arguments-to-generate-files" rel="noopener noreferrer"&gt;this&lt;/a&gt;, as it resulted in a more suitable folder structure. I also added a &lt;em&gt;PublishBuildArtifacts@1&lt;/em&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/TestApplication.sln'
  buildPlatform: 'ANY CPU' # x86
  buildConfiguration: 'Release'
  buildversion: 1.0.0

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(build.artifactStagingDirectory)'
    ArtifactName: '$(buildversion)'
    publishLocation: 'Container'


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I ran this YAML file multiple times using PowerShell tasks to display the environment variables at different stages of the pipeline.&lt;/p&gt;

&lt;h4&gt;
  
  
  Overall look at the directory structure
&lt;/h4&gt;

&lt;p&gt;This image shows a big-picture look at the directory structure after one complete run of the pipeline.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flgl3rixyjoa8atfxc505.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flgl3rixyjoa8atfxc505.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Summary of when each directory is used
&lt;/h4&gt;

&lt;p&gt;Most of this information, though publicly available on the Microsoft &lt;a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&amp;amp;tabs=yaml" rel="noopener noreferrer"&gt;docs&lt;/a&gt;, is not very intuitive to a beginner. I hope that this table summarizes the usage of the most relevant directories.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Directory&lt;/th&gt;
&lt;th&gt;Uses&lt;/th&gt;
&lt;th&gt;References&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;/a&lt;/td&gt;
&lt;td&gt;This is the working director for agent &lt;em&gt;a&lt;/em&gt;.&lt;/td&gt;
&lt;td&gt;Agent.WorkFolder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/a/1/a&lt;/td&gt;
&lt;td&gt;Artifact staging directory. This is where the VS Build task results are stored in. The publish build artifacts task creates an artifact of whatever is in this folder. Note - it gets purged before each new build.&lt;/td&gt;
&lt;td&gt;Build.StagingDirectory, System.ArtifactsDirectory, Build.ArtifactStagingDirectory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/a/1/b&lt;/td&gt;
&lt;td&gt;The output folder for compiled binaries.&lt;/td&gt;
&lt;td&gt;Build.BinariesDirectory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/a/1/s&lt;/td&gt;
&lt;td&gt;Source directory. This is the working directory and where your source code is stored.&lt;/td&gt;
&lt;td&gt;Build.SourcesDirectory, System.DefaultWorkingDirectory&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;This information was very helpful to me when it came down to customizing a YAML for my project. I wasn't able to find any existing documentation or articles like this, so please feel free to add links in the comments to similar articles if they exist.&lt;br&gt;
:)&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
