CLI equivalent for <SonarQubeTestProject>

I have dotnet source code and test code in the same cs project

Adding <SonarQubeTestProject>false</SonarQubeTestProject> inside .csproj provides the necessary functionality.

What is the equivalent property to use for the CLI as an argument - end goal is to use in a pipeline as a step without any dependency inside the app code (also without such as:

dotnet sonarscanner begin / /d:sonar.login=TOKEN


Welcome to the community!

There is not equivalent for the CLI because you can’t analyze .NET code with the SonarScanner CLI.

And if you’re talking about using the CLI for non-.NET code, then it’s a moot point because the other scanners don’t detect/designate projects/modules as “test projects”.


Maybe my description wasn’t clear enough; I am already scanning successfully from a pipeline action.

dotnet tool install --global dotnet-sonarscanner

dotnet sonarscanner begin / /d:sonar.login=TOKEN

My dotnet code is being scanned - sonarqube is already showing my code and if i add <SonarQubeTestProject>false</SonarQubeTestProject> to the csproj all is working as expected.

What i would like to do is not having to change the csproj to just scan my code but use some form of parameter to the sonar scanner as an argument just like any other scanner configuration example:
/ or /d:sonar.login



Thanks for the clarification.

I get not wanting to change your project files. Unfortunately, a command-line switch / analysis parameter for that isn’t available.



Most solutions separate test code into their own project, so this is an unusual use case. Is there a reason you aren’t able to have separate test projects?


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