TIP: How to change the FxCop naming/design rules to fire on internals [David Kean]

By default, the FxCop naming and design rules only fire on publicly visible types and members. There are a couple reasons for this:

  • The .NET Framework Design Guidelines, which FxCop enforces, only contains guidelines for publicly visible API. What internal Microsoft teams (and you) do with their internal types and members is completely up to them.

  • Noise. If you tend to wrap a lot of native types and members, then this internal API could be potentially fire numerous violations.

However, if you would feel like you would like to be consistent with both your internal and customer facing API, then a little known feature is the ability to override this default in FxCop.

To do this, simply do the following:

  1. Using FxCop, open your FxCop project

  2. Choose Project -> Options

  3. Choose the Spelling & Analysis tab and check Run all overridable rules against all targets

  4. Click OK

Unfortunately, it is not possible to currently change this in Visual Studio Code Analysis.

Comments (4)

  1. This is great.  I was hoping that there was a way to fire the rules on internals in order to enforce coding srandards.  I’ll check it out at once!

  2. Adi says:

    How do you enable this for VS Team system?

  3. davkean says:

    No it is not possible to enable this for Visual Studio.

  4. A while ago I mentioned that FxCop (and hence Managed Code Analysis) naming and design rules only fire

Skip to main content