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 sonar-project.properties) such as:
dotnet sonarscanner begin /d:sonar.host.url=HOST /d:sonar.login=TOKEN
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.host.url=HOST /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:
/d:sonar.host.url or /d:sonar.login
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?