Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable warnings for automatic generated code/folder/namespace

I like to have clean, "0 warnings" - projects in C#. This includes my project having XML comments for every public property and class.

Now I use entity framework with migrations (code first). The migrations are created by using "Add-Migration" which cause automatic code to be generated in the Migrations folder (standard behavior). I might want/need to modify these classes a bit but do not want to add Comments for the public classes created there.

I know I can disable the warnings using #pragma disable but again do not want to have to do this for every Migration-class.

So: Is there a possibility to use #pragma disable (or something similar) on a complete folder or namespace?

I do NOT want to use something like GhostDoc as a workaround.

like image 350
Ole Albers Avatar asked May 21 '15 08:05

Ole Albers


Video Answer


1 Answers

To suppress warnings for generated code in a project

  • Right-click the project in Solution Explorer, and then click Properties.
  • Click Code Analysis.
  • Select the Suppress results from generated code check box.

Reference: How to: Suppress Code Analysis Warnings for Generated Code

like image 139
Matt Avatar answered Sep 18 '22 00:09

Matt