Good afternoon,
I am creating a Azure DevOps pipeline using SonarCloud and C# project.
The problem that I am facing is the following one:
Having this YAML file
-
- task: PowerShell@2
displayName: 'Install Testing Coverage Requeriments'
inputs:
targetType: 'inline'
script: |
dotnet tool install --global dotnet-reportgenerator-globaltool
exit 0
- task: SonarCloudPrepare@1
displayName: 'Preparing Sonar Cloud environment'
inputs:
SonarCloud: 'SonarCloud'
organization: organization'
scannerMode: 'MSBuild'
projectKey: 'projectKey'
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll,**/Migrations/*
sonar.cs.vstest.reportsPaths=/**/*.trx
sonar.qualitygate.wait=true
sonar.cs.vscoveragexml.reportsPaths=/**/*.cobertura.xml
sonar.cs.dotcover.reportsPaths=/**/*.cobertura.xml
sonar.verbose=true
- task: DotNetCoreCLI@2
displayName: 'DotNet - Restore'
inputs:
command: 'restore'
projects: '${{ parameters.solution }}'
- task: DotNetCoreCLI@2
displayName: 'DotNet - Add Coverlet.MsBuild'
inputs:
command: 'custom'
custom: 'add'
projects: '${{ parameters.testProject }}'
arguments: 'package coverlet.msbuild'
- task: DotNetCoreCLI@2
displayName: 'dotnet - Build'
inputs:
command: 'build'
projects: '${{ parameters.solution }}'
arguments: '-c ${{ parameters.buildConfiguration }} ${{ parameters.dotnetCustomArguments }}'
- task: DotNetCoreCLI@2
displayName: 'Test - Execute'
inputs:
command: test
projects: '${{ parameters.testProject }}'
publishTestResults: true
arguments: '-c ${{ parameters.buildConfiguration }} /p:CollectCoverage=true "/p:CoverletOutputFormat=\"json,cobertura\"" /p:CoverletOutput="${{ parameters.coverageRootPath }}/" /p:MergeWith="${{ parameters.coverageRootPath }}/coverage.json" "/p:Exclude=\"[*.Test]*,[xunit.*]*,[*]System.*\""'
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
I am getting this error
14:11:15.840 INFO: Sensor C# File Caching Sensor [csharp] (done) | time=89ms
14:11:15.841 INFO: Sensor C# Tests Coverage Report Import [csharp]
14:11:15.842 DEBUG: Analyzing coverage with wildcardPatternFileProvider with base dir ‘/home/vsts/work/1/.’ and file separator ‘/’.
14:11:15.843 DEBUG: Pattern matcher extracted prefix/absolute path ‘/home/vsts/work/1/.’ from the given pattern ‘//*.cobertura.xml’.
14:11:15.844 DEBUG: Gathering files for wildcardPattern '/.cobertura.xml’.
14:11:15.909 DEBUG: Pattern matcher returns ‘1’ files.
14:11:15.910 DEBUG: The current user dir is ‘/home/vsts/work/1’.
14:11:15.911 INFO: Aggregating the HTML reports from ‘/home/vsts/work/1/./s/src/back/coverage/coverage.cobertura.xml’.
14:11:15.916 WARN: Could not import coverage report ‘./s/src/back/coverage/coverage.cobertura.xml’ because ‘Only dotCover HTML reports which start with “” are supported.’. Troubleshooting guide: [Coverage] Troubleshooting guide for .NET code coverage import
14:11:15.917 DEBUG: Pattern matcher extracted prefix/absolute path ‘/home/vsts/work/1/.’ from the given pattern '/**/.cobertura.xml’.
14:11:15.918 DEBUG: Gathering files for wildcardPattern ‘**/*.cobertura.xml’.
14:11:15.982 DEBUG: Pattern matcher returns ‘1’ files.
14:11:15.983 DEBUG: The current user dir is ‘/home/vsts/work/1’.
14:11:15.984 INFO: Parsing the Visual Studio coverage XML report /home/vsts/work/1/./s/src/back/coverage/coverage.cobertura.xml
14:11:16.022 WARN: Could not import coverage report ‘./s/src/back/coverage/coverage.cobertura.xml’ because ‘Missing root element in /home/vsts/work/1/./s/src/back/coverage/coverage.cobertura.xml at line 2’. Troubleshooting guide: [Coverage] Troubleshooting guide for .NET code coverage import
14:11:16.023 DEBUG: Analyzing coverage after aggregate found ‘0’ coverage files.
14:11:16.024 DEBUG: The total number of file count statistics is ‘0’.
Obviously, the coverage file was created and I can see the result in the pipeline
What am I missing?
Thank you in advance for your help.
Cheers.