Custom threshold for CA1502
问题 Is there any way to change the thresholds for CodeAnalysis rules? 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? 回答1: Yes, this is possible. Unfortunately, the only way to provide custom rule settings for a configurable rule is via a .fxcop project file, which doesn't integrate terribly