title: Azure Pipelines multi project and platform build
body: <p>I have complex-ish C# solution to build through Azure Pipelines. </p>
  
  <p>This is a MonoGame v3.7.1 project with several projects that I'm hosting in a public GitHub repo. The solution structure looks like this:</p>
  
  <pre><code>- AzureTest
      - AzureTest.Core
      - AzureTest.DirectX
      - AzureTest.OpenGL
  </code></pre>
  
  <p>The Core project is a shared project and cannot be run, while DirectX and OpenGL both reference .Core and can be run. All game code will live in the Core project.</p>
  
  <p>My current azure-pipelines.yml config file looks like this:</p>
  
  <pre><code># .NET Desktop
  # Build and run tests for .NET Desktop or Windows classic desktop solutions.
  # Add steps that publish symbols, save build artifacts, and more:
  # https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
  
  trigger:
    branches:
      include:
      - '*'
  
  pool:
    vmImage: 'windows-latest'
  
  variables:
    solution: '**/*.sln'
    buildPlatform: 'x86'
    buildConfiguration: 'Release'
    monoGameVersion: 'v3.7.1'
  
  steps:
  - task: GitVersion@5
    inputs:
      runtime: 'full'
      updateAssemblyInfo: true
      configFilePath: 'gitversion.yml'
  
  - script: |
      powershell -Command "(New-Object System.Net.WebClient).DownloadFile('https://github.com/MonoGame/MonoGame/releases/download/$(monoGameVersion)/MonoGameSetup.exe', '.\MonoGameSetup.exe')"
    displayName: 'Download MonoGame $(monoGameVersion)'
  
  - task: ExtractFiles@1
    inputs:
      archiveFilePatterns: 'MonoGameSetup.exe'
      destinationFolder: './tmp/'
    displayName: 'Extract MonoGame $(monoGameVersion)'
  
  - script: |
      mkdir "%PROGRAMFILES(X86)%\MSBuild"
      xcopy .\tmp\$PROGRAMFILES\MSBuild "%PROGRAMFILES(X86)%\MSBuild" /E /Y
      mkdir "%PROGRAMFILES(X86)%\MonoGame\v3.0\Assemblies\"
      xcopy .\tmp\Assemblies "%PROGRAMFILES(X86)%\MonoGame\v3.0\Assemblies" /E /Y
    displayName: 'Install MonoGame $(monoGameVersion)'
  
  - task: NuGetToolInstaller@1
  
  - task: NuGetCommand@2
    inputs:
      restoreSolution: '$(solution)'
  
  - task: VSBuild@1
    inputs:
      solution: '$(solution)'
      platform: '$(buildPlatform)'
      configuration: '$(buildConfiguration)'
  </code></pre>
  
  <p>This downloads the specified version of MonoGame, extracts and installs it (I found the config from <a href="https://www.jon-cloud.net/build/2019/09/09/building-monogame-with-azure-devops.html" rel="nofollow noreferrer">this article</a>). Understandibly, this will just build whatever project is set as the startup project in the solution. I'm also using GitVersion for auto-versioning, the config file looks like this:</p>
  
  <pre><code>mode: Mainline
  branches: {}
  ignore:
    sha: []
  </code></pre>
  
  <p>I would like to run a pipeline job/task/stage that builds the DirectX project under Windows, and the OpenGL project under Windows, MacOS and Linux, and possibly create artifacts for each build, though I haven't looked into artifacts yet. I'm fairly new to using Azure Pipelines so I'm unsure if I should create separate azure-pipeline.yml files for each platform/project, or if I can define the platform config in a single pipeline config.</p>