Recently I had an issue where I had to suppress certain errors coming out of ASP.NET configuration files. Since Web.config isn’t a code per se we need to use global suppression file to suppress errors coming out of config file.
The real problem was that the issues where reported not in the project where the file Web.config is located but from a different project in solution:
d:\BuildTest\Any CPU\Release\DeploymentDrop\Web.config(27): warning : CA3114 : Microsoft.Security.Web.Configuration : Always
enable custom errors to return generic error information. Set mode attribute to “On” in unit MyProject file d:\BuildTest\Any CPU\Release\DeploymentDrop\Web.config line 14 column 4 [D:\PathInTFS\MyProject\MyProject.csproj]
The issue was solved by adding GlobalSuppressions.cs to MyProject where there issue was showing up (not where Web.config lives!):
Note that SuppressMessage above will suppress all CA3114 messages in the project.