Code coverage and unit tests count of .net core solution in Sonarqube

This post describes a way to pass a .net core solution with xUnit to Sonarqube and contains an example of integration Sonarqube with GitHub Actions.

Requirements

Post is not ready, but script for Sonarqube is below

Script

dotnet-sonarscanner begin /k:"YOUR_PROJECT_NAME" /d:sonar.login="YOUR_SONAR_TOKEN" /d:sonar.host.url="YOUR_SONAR_URL" /d:sonar.cs.opencover.reportsPaths="**\coverage.opencover.xml" /d:sonar.cs.xunit.reportsPaths="**\TestResults.xml"
dotnet build
dotnet test --logger:xunit --no-build
dotnet test --no-build --collect "XPlat Code Coverage" --no-build  -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
dotnet-sonarscanner end /d:sonar.login="YOUR_SONAR_TOKEN"