Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use FxCop and why?

Tags:

c#

.net

fxcop

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?

like image 379
stiank81 Avatar asked Jan 27 '10 08:01

stiank81


People also ask

What is FxCop tool used for?

FxCop provides a tool to help developers to follow their company's coding standards. FxCop does code analysis to check whether the new code is compliant with the coding standards and naming conventions followed by the company. FxCop will ensure that the specified rules are used in the source code.

What is FxCop and StyleCop?

StyleCop is a source code analysis tool that provides developers with an effective way to follow C# coding standards. FxCop runs against the compiled binaries as a way to understand and enforce the.NET Framework Guidelines for managed code assemblies.


2 Answers

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.

like image 196
Finglas Avatar answered Sep 28 '22 03:09

Finglas


FxCop works on compiled binaries, while StyleCop analyzes the source code directly.

Maybe you could to use it to check if a compiled assembly, as that you send to your QA/production environment, matches your company polices, if someone tries to bypass your StyleCop rules.

like image 34
Rubens Farias Avatar answered Sep 28 '22 02:09

Rubens Farias