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:
- Using FxCop, open your FxCop project
- Choose Project -> Options
- Choose the Spelling & Analysis tab and check Run all overridable rules against all targets
- Click OK
Unfortunately, it is not possible to currently change this in Visual Studio Code Analysis.
Comments
- Anonymous
August 19, 2006
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! - Anonymous
August 26, 2006
How do you enable this for VS Team system? - Anonymous
August 27, 2006
No it is not possible to enable this for Visual Studio. - Anonymous
May 15, 2007
A while ago I mentioned that FxCop (and hence Managed Code Analysis) naming and design rules only fire