如何正确标记设计器代码以使代码度量忽略它 [英] How to properly mark designer code for code metrics to ignore it

查看:40
本文介绍了如何正确标记设计器代码以使代码度量忽略它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将InitializeComponent的所有实例标记为

I marked all instances of InitializeComponent with

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

因此这些不会在代码指标分析期间显示.其余的生成代码仍被视为我的代码,尤其是每个控件的设置器和获取器.用GeneratedCode标记整个部分类(winforms设计器部分)会使整个类从代码指标中消失,所以即使是我的自定义逻辑也是如此.我正在使用Visual Studio 2010.

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.

推荐答案

代码度量标准不会故意忽略Form类,请参见

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

为Windows表单生成的代码不会被忽略,因为它是代码开发人员可以看到和更改的内容.

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.

这篇关于如何正确标记设计器代码以使代码度量忽略它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆