Using SonarLint with MSBuild

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: (Visual Studio 2022)
  • Programming language you’re coding in: C# (.Net 6)
  • Is connected mode used: Yes
    • Connected to SonarCloud or SonarQube (and which version): SonarQube on-prem Version

And a thorough description of the problem / question:

I connected my .Net 6 project to our SonarQube project on our SonarQube server (on-prem). When I run code analysis in Visual Studio menu “Analyze - Run Code Analysis” I’m getting all issues reported by SonarQube in the “Error List” window.
My question are:

  1. It is possible to run the SonarQube analysis automatically when starting a Build or Rebuild of my project in Visula Studio (not in commandline)?
  2. It is possible to suppress the compiler warings (CSxxx) on build when using the SonarQube ruleset (describe in question 1). Or isn’t it recommended? Sometimes ít seems that both ruleset will report the same issue.

Best regards