Sonarqube allows for individual files to be excluded from code coverage by adding patterns in the sonar.coverage.exclusions key. This can be done on a project level by
Summing up the above mentioned answers and also adding one point to it.
To exclude a project from SonarQube Analysis from csproj we can achieve by adding the below code in .csproj of that project
true
To exclude a file from a project
**/FileName.cs
And for multiple files
**/FileName1.cs, **/FileName2.cs
Also can refer this for regex patterns used