SonarScanner for MSBuild 5.1 does not clean targets

Versions:
SonarCloud, Azure DevOps extension, SonarScanner for MSBuild 5.1

After SonarScanner for MSBuild updated to version 5.1 all our pipelines started to fail. We have a specific use case where we “Run Code Analysis” step, and after it, we run another Visual Studio build with packaging parameter and also a parameter to treat all warnings as errors. As SonarScanner for MSBuild 5.1 does not clean targets after analysis finish, we receive all sonar warnings as errors on our packaging step.

Hi @linkessgit

Sorry for that.

As a workaround, and as explained in this other topic You can either :

  • Delete the .sonarqube folder created by the analysis after it
  • Or, in the builds you don’t want analysis to be run on, pass the /p:SonarQubeTargetsImported=true MSBuild property

HTH,
Mickaël