VS类自定义版权注释

时间:2023-03-09 17:10:15
VS类自定义版权注释

对IDE快捷方式右键-属性-打开文件位置,找到..\Microsoft Visual Studio 10.0\Common7\IDE文件夹下的..\ItemTemplates\CSharp\Code\2052文件夹,

VS2015 自动添加头部注释

让VS自动生成类的头部注释,只需修改两个文集即可,一下两个路径下个有一个 Class.cs文件

D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\1033\Class

D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class

直接双击打开Class.cs文件,就可以直接修改了

VS类自定义版权注释VS类自定义版权注释

这是开头的注释代码:

// ***********************************************************************
// Copyright (c) $year$ $username$,All rights reserved.
// CLR Version : $clrversion$
// Project:
// Assembly:$rootnamespace$
// Author:$username$
// Created:$time$
// Description:
// ***********************************************************************
// Last Modified By:$machinename$
// Last Modified On:$time$
// ***********************************************************************

以后再用VS新建Class就可以直接生成版权神马的了,而且也可以在新建一个Class以后,直接键入我对这个Class的说明了。

// ***********************************************************************
// Copyright (c) 2015 Fred,All rights reserved.
// Project:
// Assembly:Memcache.Utinity
// Author:Fred
// Created:2016/3/09 16:08:15
// Description:
// ***********************************************************************
// Last Modified By:FRED-PC
// Last Modified On:2015/2/16 16:08:15
// *********************************************************************** using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; namespace Memcache.Utinity
{
public class Class1
{
}
}

附录:

参数参考:

参数

说明

clrversion

公共语言运行库 (CLR) 的当前版本。

GUID [1-10]

用于替换项目文件中的项目 GUID 的 GUID。最多可以指定 10 个唯一的 GUID(例如,guid1))。

itemname

用户在添加新项对话框中提供的名称。

machinename

当前的计算机名称(例如,Computer01)。

projectname

用户在新建项目对话框中提供的名称。

registeredorganization

HKLM\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization 中的注册表项值。

rootnamespace

当前项目的根命名空间。此参数用于替换正向项目中添加的项中的命名空间。

safeitemname

用户在“添加新项”对话框中提供的名称,名称中移除了所有不安全的字符和空格。

safeprojectname

用户在“新建项目”对话框中提供的名称,名称中移除了所有不安全的字符和空格。

time

以 DD/MM/YYYY 00:00:00 格式表示的当前时间。

userdomain

当前的用户域。

username

当前的用户名。

webnamespace

当前网站的名称。在 Web 窗体模板中使用此参数以确保类名称是唯一的。如果网站位于 Web 服务器的根目录下,则此模板参数将解析为 Web 服务器的根目录。

year

以 YYYY 格式表示的当前年份。

/*
* Assembly: $rootnamespace$
* Class : $safeitemname$ CLR.v$clrversion$
* ─────────────────────────────────────────────────────────────
* Created : $username$ $time$
* Copyright (c) $year$ All rights reserved.
* ─────────────────────────────────────────────────────────────
*/

http://www.cnblogs.com/FredLee/p/4294360.html

http://www.cnblogs.com/stg609/p/3702793.html

http://www.cnblogs.com/Leo_wl/p/3144549.html