跟创建目录差不多,模板其实也很简单,主要是注意程序集和命名空间的引用。模版源码如下: <%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Generates a class including a special informational header" %><%@ Assembly Name="CodeSmith.CustomProperties" %><%@ Import Namespace="CodeSmith.CustomProperties" %><%@ Import Namespace="System.IO" %><%@ Import Namespace="System.Windows.Forms.Design"%><%@ Assembly Name="System.Design" %><script runat="template"> private string _userFileName = @"c:\test.txt"; [Editor(typeof(FileNameEditor), typeof(System.Drawing.Design.UITypeEditor)), Category("Custom"), Description("User selected file.")]public string UserFileName%> 相关文章: 2021-10-23 2022-12-23 2021-09-12 2022-02-09 2022-12-23 2022-12-23 2022-12-23 2022-01-18