vs2013添加版权(转)

路径:D:\**\VS2013\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class

 

1、在visual studio 2013的安装路径下找到“D:\**\VS2013\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class”。

 

2、打开Class.zip里面有一个Class.cs文件,打开对其进行修改,当在WinForm中添加类文件的时候,类文件就会自动添加上我们添加的版权信息.

 

using System;

using System.Collections.Generic;

using System.Text;

namespace $rootnamespace$

{

//=====================================================

//Copyright (C) 2008-2009 小科

//All rights reserved

//guid1: $guid1$

//guid2: $guid2$

//guid3: $guid3$

//guid4: $guid4$

//guid5: $guid5$

//CLR版本: $clrversion$

//新建项输入的名称: $itemname$

//机器名称: $machinename$

//注册组织名: $registeredorganization$

//命名空间名称: $rootnamespace$

//文件名: $safeitemname$

//当前系统时间: $time$

//当前登录用户名: $username$

//创建年份: $year$

//http://www.mingribook.com

//======================================================

class $safeitemrootname$

{

}

}

$rootnamespace$为生成类的命名空间的名字,$safeitemrootname$为生成类的类名。

可以看到我们在版权信息中加入了$time$,它就可以直接给我们加入创建的时间。

说明:对于做Windows开发的人员来说可以在ItemTemplatesCacheCSharpWindows Forms2052里进行修改;对于做Web开发的人员来说可以在ItemTemplatesCacheCSharpWeb2052里进行修改。

3、然后新建一个类文件就可以自动插入我们自定义的版权信息。

运行效果如图1所示。

 (转) <wbr>C#中为自己的代码自动添加版权信息
posted @ 2017-03-23 11:37  温柔牛  阅读(574)  评论(0编辑  收藏  举报