---
title: "为VS2005的模板添加注释"
author: "devilhand"
date: "2010-11-27T13:43:46Z"
tags: []
categories: ["非技术"]
slug: "vs2005"
draft: false
lastmod: "2011-08-17T17:07:48Z"
id: 826247
url: "https://devilhand.iteye.com/blog/826247"
---

打开C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE\\ItemTemplates\\CSharp\\2052

```
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1033
```

 

分别为Class.zip、Interface.zip、Form.zip添加注释（以Class.zip为例）

```
/***********************************************************************  
* Copyright(c) $year$ 公司  
* CLR 版本: $clrversion$  
* 文 件 名：$safeitemrootname$.cs  
* 创 建 人：FK  
* 创建日期：$time$  
* 修 改 人：  
* 修改日期：  
* 备注描述：          
************************************************************************/ 
using System;
using System.Collections.Generic;
using System.Text;

namespace $rootnamespace$
{
	class $safeitemrootname$
	{
	}
}
```

 

注意：不要解压，直接修改就好了。

 

在vs自带的命令行中运行

```
devenv /setup 
```

 

这里$var$ 都是系统的变量，模板参数是要区分大小写的，大家需要注意。系统提供的可用的参数如下：

参数  说明   
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  
 当前的用户名。  
   
year  
 以 YYYY 格式表示的当前年份。