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;

No comments: