VS2012类默认模板修改
下面就是实现的方法,以Microsoft Visual Studio 2012为例:
1,打开你Visual Studio 2012安装的目录,找到ItemTemplates文件夹 例如:
C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates
如果想修改Winfows Form类的默认名称空间,则打开
C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\Windows Forms\2052
下面有很多压缩文件
AboutBox.zip
CustomControl.zip
Form.zip
UserControl.zip
2,将 Form.zip 解压缩,修改里面的form.cs文件内容,例如添加一行
using System.Runtime.InteropServices;
然后再压缩成zip,注意是在Form文件夹下压缩,覆盖原来的Form.zip文件。
3,最后,打开Visual Studio 2012 命令提示,执行
devenv /InstallVsTemplates
命令完成后,打开 Microsoft Visual Studio 2012,添加新新建项,你的cs 文件就变成下面的名称空间里
using System;
using System.Collections.Generic;
using https://www.360docs.net/doc/a616094000.html,ponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
其他项目的修改方法类似。
下面附上模版
#region 作者和版权
/*************************************************************************************
* CLR 版本: $clrversion$
* 类 名 称: $itemname$
* 机器名称: $machinename$
* 命名空间: $rootnamespace$
* 文 件 名: $safeitemname$
* 创建时间: $time$
* 作 者: 常伟华 Changweihua
* 版 权: $safeitemrootname$说明:本代码版权归常伟华所有,使用时必须带上常伟华网站地址 All Rights Reserved (C) $year$ - 2013
* 签 名: To be or not, it is not a problem !
* 网 站: https://www.360docs.net/doc/a616094000.html,
* 邮 箱: changweihua@https://www.360docs.net/doc/a616094000.html,
* 唯一标识: $guid1$
*
* 登录用户: $username$
* 所 属 域: $userdomain$
* 创建年份: $year$
* 修改时间:
* 修 改 人:
*
************************************************************************************/
#endregion
///
/// 摘要
///
#region 私有成员
#endregion
#region 事件方法
#endregion
#region 数据控制
#endregion