在csdn上看到一篇[如何在*.cs文件中加入版本跟蹤信息?]的文章,覺得對項目的版本控制會有一些實際意義。但是由于文中圖片的缺失,無從試驗,具體效果也無從得知。后查閱作者文中提到的博客園的隨筆,依博客園作者文中提到的一些操作一一試驗,結果和網友們一樣“我也沒弄出來!”。沒有辦法,只有試試搜索msdn了,發現其中的一篇enable keyword expansion文章,按文中的操作步驟一試果然奏效!現整理具體實現步驟分享給大家,希望對大家有所幫助!首先:運行visual sourcesafe 6.0 admin,用admin登錄vss的系統管理界面,選擇tools菜單,點擊options進入選項設置頁面,在general選項頁的expand keywords in files of type下的文本框中添入*.cs,完成后點擊[確定],保存選項。
注:如果是vb.net程序則可添入*.vb,依此類推!也可以輸入多種文件類型,如*.txt, *.c, *.vb,*.cs,*.vb以逗號隔開即可。其次:運行microsoft visual sourcesafe 6.0,進入主界面,選擇tools菜單,點擊options進入選項設置頁面,進入local files選項頁,選中copy keyword-expanded files into working folder選項,完成后點擊[確定],保存選項。下面就可以在.net的項目中加入版本跟蹤信息了。
在每一個.cs文件的最開頭加入如下代碼:
/*$header$
$author$
$date$
$revision$$history$*/
這樣,每次更改后簽入或簽出就會自動出現版本信息(請不要手動去更改):
/*$header: /testvss/testvss/testvss/class1.cs 9 05-07-26 13:50 edward.net $
$author: edward.net $
$date: 05-07-26 13:50 $
$revision: 9 $$history: class1.cs $
*
* ***************** version 9 *****************
* user: edward.net date: 05-07-26 time: 13:50
* updated in $/testvss/testvss/testvss*/
其他資源(來自y97523szb的如何在*.cs文件中加入版本跟蹤信息?):
type this keyword
to add the following
$archive: $
vss archive file location
$author: $
user who last changed the file
$date: $
date and time of last check in
$header: $
logfile, revision, date, author
$history: $
file history, vss format
$justdate: $
date, without the time addendum.
$log: $
file history, rcs format
$logfile: $
same as archive
$modtime: $
date and time of last modification
$revision: $
vss version number
$workfile: $
file name
$nokeywords: $
no keyword expansion for all keywords that follow
另外關于[如何在*.cs文件中加入版本跟蹤信息?]一文中提到的必須使用vss6.0d版本,經過本人測試vss6.0c也同樣支持以上功能。