title: Azure DevOps code coverage with .coverage for PR and Cobertura for full report
body: <p>I have an Azure DevOps pipeline that <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&amp;tabs=yaml#pr-triggers" rel="nofollow noreferrer">validates pull requests</a>. I have <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/test/codecoverage-for-pullrequests?view=azure-devops#prerequisites" rel="nofollow noreferrer">configured</a> <code>dotnet test</code> to collect code coverage metrics using the <code>--collect "Code coverage"</code> argument:</p>
  
  <pre><code>- task: DotNetCoreCLI@2
    displayName: dotnet test
    inputs:
      command: 'test'
      arguments: '--configuration $(BuildConfiguration) --collect "Code coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
      workingDirectory: $(baseWorkingDirectory)
      projects: 'tests/**/*.csproj'
      nobuild: true
  </code></pre>
  
  <p>As you can see, I'm also passing <code>/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura</code>. This I have to do in order to generete a coverage report:</p>
  
  <pre><code>- task: CmdLine@2
    inputs: 
      script: dotnet tool install -g dotnet-reportgenerator-globaltool
  
  - task: CmdLine@2
    inputs: 
      script: reportgenerator -reports:$(Build.SourcesDirectory)/tests/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines;Cobertura
  
  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
      reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage'
  </code></pre>
  
  <p><a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/test/codecoverage-for-pullrequests?view=azure-devops#prerequisites" rel="nofollow noreferrer">Documentation</a> states that <strong>code coverage for pull requests is available only using the Visual Studio code coverage results format (file extension .coverage)</strong></p>
  
  <p>So:</p>
  
  <ul>
  <li>I have to use <strong>Visual Studio code coverage</strong> <code>--collect:"Code Coverage"</code> to get code coverage for pull requests, because Cobertura format won't work.</li>
  <li>I need to use <strong>Cobertura</strong> format in order to get a readable report on the <strong>Code Coverage tab</strong> in the pipeline, but the Cobertura report won't show up if I use <code>--collect:"Code Coverage"</code> at the same time.</li>
  </ul>
  
  <p><strong>It seems I can't get both code coverage for PRs and a full report in Cobertura format at the same time.</strong></p>
  
  <p><a href="https://developercommunity.visualstudio.com/content/problem/714139/azure-pipeline-coverage-checks-not-running.html?inRegister=true" rel="nofollow noreferrer">Other people</a> seem to have the same problem, but the issue wasn't resolved in that thread.</p>
  
  <p>Am I missing something?</p>