Search code examples
c#attributesstylecopsuppress-warnings

How can I add a StyleCop rule suppression without StyleCop installed on my machine?


I would like to add a StyleCop SuppressMessageAttribute to some code but I don't want to require StyleCop to be installed.

Does my project need to reference the StyleCop binaries and if so, which ones? Also, is the StyleCop SuppressMessageAttribute different to the System.Diagnostics.CodeAnalysis.SuppressMessageAttribute?


Solution

  • You don't need stylecop installed or referenced to add a suppression. StyleCop uses the standard code analysis SuppressMessageAttribute which ships in the .NET Framework.