FxCop and Code Analysis: Writing Your Own Custom Rules

This web site is designed to address the shortage of documentation on the FxCop API. It was originally written for FxCop 1.36 (.NET 2.0/3.0/3.5) and is also valid for FxCop 10.0 (.NET 4.0).

FxCop now ships with the Microsoft Windows SDK.

The latest versions of FxCop are included in the Microsoft Windows SDKs. FxCop 1.36 (requiring .NET 3.5) is in the Microsoft Windows SDK 7.0. FxCop 10.0 (requiring .NET 4.0) is in the Microsoft Windows SDK 7.1. Once you have installed the SDK, run the FxCop installer from the Start menu under Microsoft Windows SDK, Tools, Install Microsoft FxCop.

FxCop is also integrated into the Code Analysis features of Visual Studio Team System 2008 Development Edition, Visual Studio 2010 Premium, and Visual Studio 2010 Ultimate.

Some of the highlights include the following:

  1. A brief tutorial of FxCop
  2. A listing of what kinds of customizations are possible with FxCop
  3. An overview of the introspection API
  4. How to implement custom rules
  5. How to write the XML description resource for the custom rules
  6. An advanced section on using FxCop to check doc comments
  7. Example rules

A tool called Introspector is also available here that lets you browse assemblies using the FxCop introspection object model. This lets you see precisely which objects are involved when you develop custom rules.

I hope that you find this site useful.

Contact Me: Jason Kresowaty <>

These files are provided with absolutely no warranties. All use is at your own risk.

FxCop and Code Analysis: Writing Your Own Custom Rules v1.5

Introspector v1.4

Introspector Screenshot
Copyright © Jason Kresowaty