Code coverage not reflecting on soanrqube dashboard for dotnet project

In my case the coverage report is not uploaded to the sonarqube dashboard.
I have checked the report and is not empty.
In the log I am getting this info:

INFO: Parsing the Visual Studio coverage XML report /home/runner/work/core.service/core.service/./coverage.xml
INFO: Adding this code coverage report to the cache for later reuse: /home/runner/work/core.service/core.service/./coverage.xml
INFO: Coverage Report Statistics: 386 files, 0 main files, 0 main files with coverage, 386 test files, 0 project excluded files, 0 other language files.

I am using github workflow as as follows:

- name: Sonarscan
      run: |
          ./sonar/scanner/dotnet-sonarscanner begin /k:"fugro.rochub.core.service.backend_b504b847-7e36-4329-9208-d82f0e7e3f8a" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
          dotnet build ./Source/core.service.sln --no-incremental
          dotnet-coverage collect "dotnet test ./Source/core.service.sln --settings ./Source/.runsettings --filter Category!=Integration" -f xml -o "coverage.xml"
          ./sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

I have a folder structure like this:
Source
–core.API/ (code to build under this folder)
–core.tests/ (folder containing tests)
–core.tests.database/ (folder containing database tests)

I am using sonarqube 10.5.1
I am attaching the detailed log file
logs_25420480579.zip (433.4 KB)

Can you please help me here
Thanks in advance

Solved after adding below property:

<PropertyGroup>
  <SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>

added this for main folder and made it false for test folders

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.