.NET 追寻足迹

C# 之路

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1.系统模板路径

a.项模板:E:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates

b.项目模板:E:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates

 

2.模板变量

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 格式表示的当前年份

 

 

3.新建模板的方法

新建一个项目,后点击文件菜单中的导出模板,可导出项模板或项目模板

 

4.示例

 

//===================================================================================
// Document Instruction
//===================================================================================
// Created CLR:$clrversion$
// Created Time:$time$
//===================================================================================
// Copyright (c) Grouppower Corporation.  All Rights Reserved. 
// http://www.grouppower.com/license
//===================================================================================


namespace $rootnamespace$
{
    using System;
    using System.Collections.Generic;
    $if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
    $endif$using System.Text;

    public class $safeitemname$
    {
        #region 成员变量
        
        #endregion

        #region 构造函数

        public $safeitemname$()
        {
            
        }
    
        #endregion

        #region 属性
    
        #endregion

        #region 方法

        #endregion
    }
}

 

 

posted on 2011-12-28 10:55  绿水青山  阅读(182)  评论(0编辑  收藏  举报