Which analysis parameters can be set for a single MSBuild project in csproj?

Hello, we’re using SonarCloud to analyze .NET Core code from Azure DevOps.
Since only a few have admin access to UI then we’re considering SonarQubeSetting in csproj files.

Documentation at SonarScanner for .NET | SonarCloud Docs states that “Some analysis parameters can be set for a single MSBuild project by adding them to its .csproj file.”

Are those “some analysis parameters” listed somewhere? I couldn’t find any.

Hi,

Ordinarily I’d tell you to look in the project settings UI for an idea, but obviously that won’t work here. So let’s flip it around: what are you interested in setting?

 
Ann

Hello, I’m interested in setting “sonar.sources”, “sonar.tests”, “sonar.test.inclusions”, “sonar.test.exclusions”, “sonar.exclusions”, “sonar.cpd.exclusions”, “sonar.coverageReportPaths”, “sonar.cs.xunit.reportsPaths”.

Hi,

What you’ve provided is a list of parameter names, which you can use as-is. You may additionally find the full list of coverage report parameters helpful.

 
Ann

@Parity_Zero note that you should not normally set sonar.sources or sonar.tests when using the SonarScanner for .NET (the scanner will automatically calculate those for you).

Also, setting properties per-MSBuild project should be an exception. If you can’t set the properties in the UI, a more common approach would be to set the properties for all MSBuild projects in single SonarQube.Analysis.xml. See the doc page for more information.