In a Visual Studio C# project, how do I override the SonarQube Server's default Quality Profile?

I have SonarQube Server Community Edition, version 8.9.1
with the C# Language plugin
I am using Visual Studio 2019
and my project is a C# project

My server is set to “Sonar Way” as the default for C#
However, my “projects” in SonarQube are configured to use the “My Rules” profile.

So far, everything is just great for the existing projects! However…

My CI/CD build environment creates new “projects” in the SonarQube Projects list named <project_name>__<branch_name>
…and hence, these “new” projects take on the default “Sonar Way” profile.

This is wrong. When a branch of an existing project is created, I’d like for it to take on the profile of the parent project from which is was branched.

Bottom-line, how can I specify the SonarQube Quality Profile to use in either the Visual Studio “solution” (.sln) file or “project” (.csproj) files?
…or quite frankly, any other source-level properties/configuration file


Welcome to the community!

Since you’re creating a brand new project for each branch, you’ll need to set My Rules as the default profile in order for it to be applied on new branches. Either that, or upgrade to Developer Edition($), which includes branch analysis. Then your branches will inherit their settings from the main project.


That’s real bummer :’-(
You’re telling me the project simply can’t specify the Sonar Quality Profile to use! How about using the older Sonar.Profile property? Could I put that somewhere?


If you want to create the project on first analysis and you want that first analysis to use My Rules, then it needs to be the default. On the other hand, if you’re willing to provision the project first, you can then pre-configure it to use a non-default profile. And the final option is to run the fist analysis with the default profile and edit the project after analysis/creation to use My Rules.

You can specify it, but it will be ignored. It was deprecated for years and finally removed a while ago.