msbuildsonarqube-msbuild-runner

FxCop warnings are thrown as errors by MSBuild. How do you change the errors back to warnings?


I have a huge C# project/solution with 30+ .csproj files/modules. When I try to do MSBuild FxCop warnings are thrown as errors. How do I disable warnings as error setting by modifying .sln file or as a MSBuild flag.

FYI: I'm Trying to import FxCop rules into SonarQube


Solution

  • Found a way to disable this via a compiler flag /p:CodeAnalysisTreatWarningsAsErrors=false passed to MSBuild

    Final command that parallel rebuilds ResolverService with FxCop errors processed as warnings:

    "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:Rebuild ResolverService.sln /m /p:CodeAnalysisTreatWarningsAsErrors=false

    This solution is preferable than going to each and every .csproj file and editing the <CodeAnalysisTreatWarningsAsErrors> tag to false.