This question: Custom threshold for CA1502 discusses how to set up custom thresholds for code metrics rules in code analysis.
I have the same problem, but think that the old question is out of date.
To repeat:
In particular, we would like our Build to fail when a method has a code complexity of more than 20. Unfortunately, rule CA1502 has a threshold of 25:
The rule reports a violation when the cyclomatic complexity is more than 25.
Can we somehow change this?
The accepted answer is to edit an .fxcop file to include the rules. In visual studio 2013 ultimate we have integrated Code Analysis and Code metrics; but we don't appear to have .fxcop rules - I think this used to be when fxcop was a separate extension.
Is there any way to edit the thresholds in the .ruleset files produced by visual studio? Or have I missed how and where to get .fxcop files in the more recent versions?