Currently we're running SonarQube analyses during our build proces. We've wanted to run our quality profile locally in Visual Studio 2015. For this we've created a ruleset for Visual Studio and turned on the rules that were enabled in our quality profile. SonarLint has an intergration for this, but the FxCop rules aren't synced (at the moment). When enabled FxCop rules Visual Studio freezes. So this wasn't an option for us.
Another option we've tried is instead of creating a ruleset based on FxCop and Roslyn. Was trying to create a roslyn only ruleset. So we've added the FxCop port to Roslyn rules NuGet package to out projects. But when we ran SonarQube with MSBuild Runner 2.1 we received the following error: MSBUILD : error : CA0059 : Invalid settings passed to CodeAnalysis task. See output window for details. We get this error even when we didn't turn on these rules or use the default Microsoft Ruleset.
When I take a look at the MSBuild log I see the following (removed a lot of rules for readability):
/rulesetdirectory:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\\Rule Sets"
/rule:"-C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\\Rules"
/ruleid:"-Microsoft.Performance#CA1820"
/ruleid:"-Microsoft.Reliability#CA2002"
/ruleid:"-Microsoft.Usage#CA1816
-Microsoft.Usage#CA2208"
/ruleid:"-Microsoft.Usage#CA2216"
/searchgac /ignoreinvalidtargets
/forceoutput /successfile /ignoregeneratedcode /saveMessagesToReport:Active,Excluded
/timeout:120
/reportMissingIndirectAssemblies
Switch '/microsoft.usage#ca2208" /ruleid' is an unknown switch.
Type 'FxCopCmd.exe /?' for help on command-line arguments.
MSBUILD : error : CA0059 : Invalid settings passed to CodeAnalysis task. See output window for details.
Code Analysis Complete -- 1 error(s), 0 warning(s)
It looks like SonarQube isn't correctly generating the FxCop argument in this situation. Does anyone know a fix for this problem?
Thanks in advance.
I've created a GitHub repro where this problem can be reproduced: https://github.com/mvdiemen/SonarQubeFxCopRoslyn