VS添加默認註釋,添加做者信息,打開 VS安裝文件夾\Common7\IDE\ ,找到裏面的 ItemTemplates 文件夾,或者 ItemTemplatesCache 文件夾,修改裏面的代碼文件,使用註釋的方式添加默認文本.同理能夠修改ProjectTemplates 和 ProjectTemplatesCache文件夾裏面的代碼,而後建立項目的時候就能夠看到本身添加的內容了. web
注意: 修改 ItemTemplatesCache 文件夾的文件內容以後,VS一段時間後會從 ItemTemplates 生成,複製過去,因此,若是要永久修改的話能夠修改ItemTemplates下的內容,可是不可恢復.若是修改了ItemTemplates ,須要使用 shell
devenv /setup
來使VS生效. c#
我修改的代碼以下: 安全
/******************************************************************************** ** Copyright(c) $year$ $registeredorganization$ All Rights Reserved. ** 描述:$safeitemrootname$ ** 做者:任真 ** 郵箱:674038364@qq.com ** 日期:$time$ ** 版本:v1.0.0 *********************************************************************************/ using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text; $if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks; $endif$ namespace $rootnamespace$ { class $safeitemrootname$ { } }
其中的 $var$ 的是系統參數,支持的參數有: 服務器
參數 |
說明 dom |
||
clrversion |
公共語言運行庫 (CLR) 的當前版本。 |
||
GUID [1-10] |
用於替換項目文件中的項目 GUID 的 GUID。最多能夠指定 10 個惟一的 GUID(例如,guid1))。 |
||
itemname |
用戶在 添加新項 對話框中提供的名稱。 |
||
machinename |
當前的計算機名稱(例如,Computer01)。 |
||
projectname |
用戶在 新建項目 對話框中提供的名稱。 |
||
|
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 格式表示的當前年份。 |
/******************************************************************************** ** Copyright(c) 2016 All Rights Reserved. ** 描述:Class1 ** 做者:任真 ** 郵箱:674038364@qq.com ** 日期:2016/3/24 11:23:01 ** 版本:v1.0.0 *********************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ClassLibrary1 { public class Class1 { } }