解决方法
看看
StyleCop.
StyleCop analyzes C# source code to enforce a set of style and consistency rules. It can be run from inside of Visual Studio or integrated into an MSBuild project. StyleCop has also been integrated into many third-party development tools.
您甚至可以添加自定义规则:Creating Custom Rules for Microsoft Source Analyzer
希望它有帮助.