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

梦想与她 提交于 2020-01-15 08:58:09

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/12306263/how-to-properly-mark-designer-code-for-code-metrics-to-ignore-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!