How to: Suppress Code Analysis Warnings for Generated Code
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Managed code compilers often generate code that is added to a project to facilitate rapid code development. In addition, developers often use third-party tools to help develop applications quickly. These tools also generate code that is added to the project.
You might want to see the rule violations that Code Analysis discovers in generated code. However, you might not want to see them if you cannot view and maintain the code that contains the violation.
The Suppress results from generated code check box on the Code Analysis property page of a project enables you to select whether you want to see Code Analysis warnings from code generated by a third-party tool.
This option does not suppress Code Analysis errors and warnings from generated code when the errors and warnings appear in forms and templates. You can both view and maintain the source code for a form or a template.
Right-click the project in Solution Explorer, and then click Properties.
Click Code Analysis.
Select the Suppress results from generated code check box.