Configured sonarcloud to existing Azure pipeline
Created pipeline with classic editor and added sonar task to it.
image : Ubuntu latest
Use .Net Core sdk 6.0.x
Prepare Analysis on sonarcloud
dotnet build
dotnet test
Run code analysis
copying files to staging
publish artifact
Build image using docker
push image to ACR
deploy on AKS
addition properties:
sonar.exclusions=**/obj/**,**/*.dll
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*.xml
dotnet test
Arguments:
--collect "Code Coverage" ---> tried with --logger trx --collect:"XPlat Code Coverage"
checked Publish test result as well
On exection of pipeline
can see the code coverage result in Azure pipeline UI but not sonarcloud
on Dotnet test
can see the .trx, coverage.cobertura.xml and .coverage in $(Agent.TempDirectory)
on Run code analysis
INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report /home/vsts/work/_temp/XXXXXXX-XXXXXXXX/packs/Microsoft.NETCore.App.Ref/6.0.19/ref/net6.0/System.Runtime.InteropServices.RuntimeInformation.xml
WARN: Could not import coverage report '/home/vsts/work/_temp/XXXXXXX/packs/Microsoft.NETCore.App.Ref/6.0.19/ref/net6.0/System.Runtime.InteropServices.RuntimeInformation.xml' because 'Missing root element <CoverageSession> in /home/vsts/work/_temp/XXXXXXXX/packs/Microsoft.NETCore.App.Ref/6.0.19/ref/net6.0/System.Runtime.InteropServices.RuntimeInformation.xml at line 2'. Troubleshooting guide: https://community.sonarsource.com/t/37151
INFO: Parsing the OpenCover report /home/vsts/work/_temp/XXXXXXXX/packs/Microsoft.AspNetCore.App.Ref/6.0.19/ref/net6.0/System.IO.Pipelines.xml
Please help me with what I am missing here to get the code coverage result in sonarcloud
Note: I am new to this sonarcloud