Thursday, March 12, 2009

FxCop: exclude the naming rule for some words

I used the Iframe identifier in my project and FxCop did not like it.

The way to get around this without rename everywhere is to include a custom dictionary named CustomDictionary.xml in the project directory.


for more info: http://msdn.microsoft.com/en-us/bb264492.aspx

Friday, March 06, 2009

FxCop to Excluded in Source

There are 2 ways to make the rule exceptions in FxCop. One way is to update the .fxcop file. Another way is to update your source code.


For Excluded in Source, add add the following line on top of the method/function/data members.

[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Need to set Specialties collection")]

Also, need to declare System.Diagnostics.CodeAnalysis in your source file.

using System.Diagnostics.CodeAnalysis;