NUnit not analyzed

I cannot get SonarQube to analyze C# code for my NUnit solution. The code is found under the lines category but is not included in lines of code. Is there a reason my C# code might be ignored in this context?

dotnet sonarscanner begin /k:“my_key” /d:sonar.host.url=“my_url” /d:sonar.login=“my_login” /d:sonar.verbose=true /d:sonar.dotnet.excludeTestProjects=false /d:sonar.coverage.exclusions=**/.

NOTE: This behavior is not seen in projects other than my NUnit projects.

.sonarqube.zip (4.1 MB)

Hey there.

To explicitly mark a project as not being test for the S4NET you need to use the SonarQubeTestProject MSBuild property:

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

While sonar.dotnet.excludeTestProjects is a valid analysis parameter… it’s not doing what you think it’s doing.

1 Like

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