C# – Should I use FxCop and why

cfxcopnet

I'm working on a project in C# .net and WPF. We're using StyleCop to help bring a consistent style to the project, and after disabling some rules we're quite satisfied with it. However, I've heard people talk about FxCop, and that this would bring value to the project too. From what I understand this is more on a code structure base..?

Could someone give me any specific reasons why we should start using FxCop? What are the most important things FxCop will ensure that we do correctly?

Best Answer

It detects some useful conditions and can improve your coding style. By style I don't just mean bracket placement and so on. But issues such as abstract classes having public constructors and many other specalist cases. It's little things like this it picks up, and after a while you do them automatically.

Starting a new project with it is easy, using it with an existing project is harder as it will detect more issues. It's worth noting you will have to configure FxCop at first, as it will point out trivial things which may not be of concern.