I have used below tasks to publish the code coverage to sonacloud in azure pipeline, but alway showing 0 code coverage, But i can see the coverage in azure pipeline.
-
task: SonarCloudPrepare@1
inputs:
SonarCloud: ‘SonarCloud-GAPI’
organization: ‘rlhc’
scannerMode: ‘MSBuild’
projectKey: ‘RLHC_MemberService-GAPI’
projectName: ‘MemberService’
extraProperties: |
sonar.projectBaseDir=$(System.DefaultWorkingDirectory)
sonar.scm.provider=git
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)//coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)//*.trx -
task: DotNetCoreCLI@2
inputs:
command: ‘test’
projects: ‘**/MemberGraphQL.Tests.csproj’
publishTestResults: true
arguments: ‘–configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --collect “Code Coverage”’
displayName: “Run unit tests with code coverage”