TIP: Automatically generate Managed Code Analysis/FxCop suppressions

I see a lot of users attempting to hand code a SuppressMessageAttribute themselves. This can be error prone and is not needed when both Visual Studio and the standalone FxCop can automatically generate these for you.

In Visual Studio 2005

  1. Right-click a Code Analysis warning in the Error List and choose Suppress Message(s).

In Visual Studio Orcas

  1. Right-click a Code Analysis warning in the Error List and choose Suppress Message(s) -> In Source or Suppress Message(s) -> In Project Suppression File

In FxCop

  1. Right-click a warning and choose Copy As -> SuppressMessage.
  2. Paste the contents of the Clipboard at the top of the code element that caused the warning.

Note: In both Visual Studio and FxCop you can select multiple warnings and suppress them all once.