Stylecop vs FXcop 区别

来源:互联网 发布:威廉马歇尔 知乎 编辑:程序博客网 时间:2024/05/29 13:32

Stylecopis a style analysis tool that works at the source codelevel. It exists primarily to provide a single common style that managedprojects can use to remain consistent within the larger world of managedsoftware. It makes decisions regarding style primarily to avoid holy wars(after all, style is almost always an inherently subjective thing). I don'tthink I've ever met someone who liked all of StyleCop's rules, but that's ok.It means that StyleCop is a generally good compromise amongst the vast set ofstyle guidelines that exist. (If Stylecop's rules were highly customizable,beyond simply enabling/disabling them, it would defeat the entire purpose ofthe tool.)

FxCop, on the other hand, is a static analysis tool that works on the level of the managed assembly. It can be given directions via attributes because it can see attributes on code elements, e.g.. It detects problems that can be seen on the "binary" level (as it were) as opposed to the syntactic level.

Important: StyleCop doesn't supersede FxCop, andFxCop doesn't supersede stylecop. They're two different tools with two different purposes that can both provide a real benefit for your code. 

Stylecop works on your C# source code. Fxcoplooks at your compiled code from any .net language.


原创粉丝点击