FxCop (Framework Police) is a free code analysis tool provided by Microsoft basically intended for class library developers. It is a must have tool for new developers who want help in getting familiarized with Microsoft Design Guidelines. FxCop helps to write robust code and easily maintain code by telling you about the possible design, localization, performance and security improvements. It can prevent flaws in the code and helps the programmer to follow best practices.
FxCop is fully integrated in the Visual Studio and is distributed as both a fully featured application that has a graphical user interface (FxCop.exe) for interactive work, and a command-line tool (FxCopCmd.exe) suited for use as part of automated build processes or integrated with Microsoft Visual Studio® .NET as an external tool. It analyses Binary Common Intermediate Language (CIL) instead of the source code, it is not language specific tool and can be used for analysing a dll written in any programming language.
FxCop reads the metadata (data about data) contained in the .Net Assembly and checks it for compliance against built in custom rules and recommended coding standard and practices.
FxCop not only provides 200+ built in rules broadly classified into the following categories:
- Design Rules
- Globalization Rules
- Naming Rules
- Portability Rules
- Interoperability Rules
- performance Rule
- Security Rules
- Usage Rules
but also gives you the option of adding custom rules and new keywords to FxCop dictionary.
To use FxCop: download it from www.microsoft.com/downloads. Start FXCop Application. Add a project by clicking on File - New Project. Add target dlls by clicking on Projects - Add Targets. Click Analyze...
Once FxCop has analyzed the assemblies, it reports any rule violations and produces well-formatted XML test reports.
One may think "Do we fix all warnings? " Well, you must validate all the warning, and fix only ones that are appropriate for the project. I don't mean that FxCop gives you warnings that are not needed to be fixed. But you can skip few depending on your requirements. eg: An application that will only be used on one machine, can ignore portability related warnings
For more information on FxCop visit http://msdn.microsoft.com/en-us/library/bb429473(v=vs.80).aspx
Comments
Post a Comment