Keyword Expansion in Visual SourceSafe
Keyword expansion is a cool feature that automagically plants metadata from an external
source in a file--typically between two pre-defined characters or strings--when some
event occurs. In SourceSafe, there are twelve
standard keywords to which various types of metadata are appended when a
file in which they reside is checked in[1].
The online documentation provides a pretty good
overview of SourceSafe keyword expansion and some interesting tips and tricks to
help you maximize the utility of the feature. It also explains how
to enable keyword expansion in VSS. Please note that there is a minor documentation
bug in this
topic. The code that appears below "If no keyword comments are specified,
the following comments are assumed: " should begin with "[Keyword Comments]".
More details in the FAQs below.
IMO, the most useful Visual SourceSafe keyword is $history: $. In conjunction
with SourceSafe's
Shadow Folder feature, the $history: $ keyword is really nifty because
it allows you to know when the file was last edited and by whom even when you're not
accessing it from the database. $history: $ tells SourceSafe to add something
like the following to a file when you check it in:
'$History: Form1.vb $
'
'***************** Version 24 *****************
'User: Guest Date: 10/13/03
Time: 12:49p
'Updated in
'$/WindowsApplication8.root/WindowsApplication8
FAQs and Gotchas:
Q: How do you turn on VSS keyword expansion?
A: See how
to enable keyword expansion in VSS.
Q: I enabled keyword expansion but it is still not working. Why?
A: Before using this feature, you must close and all database clients that are connected
to the database.
...
Keywords are case-sensitive, so confirm that they are properly capitalized.
...
Keyword expansion is disabled by default. Use VSS Admin to make sure that the feature
is enabled for files of the type to which you have added keywords (eg, "*.cs").
Q: How can I automatically add comments to keyword expanded text in my source files
(*.vb, *.cs, etc)?
A: Insert the following into either your personal Ss.INI file or into the
database-wide Srcsafe.INI:
[Keyword Comments]
*.cs = "//"
*.vb = "'"
[1]Q: Can I create custom VSS keywords, such as $assembly_version: $ ?
A: No. But that would be a JAW DROPPING extensibility feature, wouldn't it?
Gotcha #1: Keyword Expansion can adversely affect performance.
Gotcha #2: Don't enable keyword expansion for binary
files. Just don't.
Additional Resources:
-
VSS
Documentation
public newsgroup: microsoft.public.vstudio.sourcesafe at [https://msdn.microsoft.com/newsgroups/](https://msdn.microsoft.com/newsgroups/) (drill
down to "Visual Tools and Languages -\> Visual SourceSafe).
- Mark Michaelis' excellent SourceSafe
FAQ: here and here. - Search related KB Articles at https://support.microsoft.com:
search for keywords: vss keyword expansion.
++++++++++++
Ce message est fourni en l état, sans garantie d aucune
sorte, et ne vous confère aucun droit. Vous assumez tous les risques liés à son utilisation.This
posting is provided "AS IS" with no warranties, and confers no rights.
Comments
Anonymous
October 14, 2003
The comment has been removedAnonymous
October 14, 2003
BTW, I found this one übercool:Private m_version As String = "$Header: $"Very useful to determine the correct revision for that class/module when things go bad..Anonymous
May 10, 2004
If your keyword expansion seems not to be working, check the codepage of the file. If it isn't in the windows standard codepage, then it doesn't work. I just changed about 50 database scripts from unicode. Keyword expansion works now...Anonymous
April 11, 2007
The comment has been removedAnonymous
May 31, 2009
PingBack from http://portablegreenhousesite.info/story.php?id=4712Anonymous
June 01, 2009
PingBack from http://portablegreenhousesite.info/story.php?id=14335Anonymous
June 18, 2009
PingBack from http://gardendecordesign.info/story.php?id=5487