我知道我迟到了,但这里有。
我猜这些警告都是针对InitializeComponent
方法中的代码发出的?如果是这样,那么您是否考虑过修改位于 Common7\IDE\ItemTemplates 文件夹中的模板文件?您可以GeneratedCode
在其中的方法上添加属性。由于该属性将仅在其上设置,因此同一类中的所有其他代码仍将通过代码分析进行检查。
Form
这是设计器文件的示例:
namespace $rootnamespace$
{
partial class $safeitemrootname$
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
[System.CodeDom.Compiler.GeneratedCode("Windows Form Designer generated code", "1.0.0.0"), System.Diagnostics.DebuggerNonUserCode()]
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "$safeitemrootname$";
}
#endregion
}
}