Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly mark designer code for code metrics to ignore it

I marked all instances of InitializeComponent with

<CodeDom.Compiler.GeneratedCode("WinForms Designer", "")>

So those will not show up during code metrics analysis. The rest of the generated code is still considered mine, particularly setters and getters for each control. Marking the whole partial class (the winforms designer part) with GeneratedCode makes the whole class disappear from code metrics, so even my custom logic. I am using Visual Studio 2010.

like image 712
Neolisk Avatar asked Dec 05 '25 23:12

Neolisk


1 Answers

Code Metrics does not ignore Form classes on purpose see http://msdn.microsoft.com/en-us/library/bb385914.aspx

Code generated for Windows forms is not ignored, because it is code that the developer can see and change.

Perhaps the Code Metrics Viewer extension will do what you want.

like image 133
Peter Ritchie Avatar answered Dec 07 '25 15:12

Peter Ritchie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!