c# - How do I arrange for VSS history to appear in code?

I recently needed to embed Visual Source Safe history in the source code of a new project, according to some examples we have in older project, where the history appears where the coder has placed certain comments. The final result is something like:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
//$Archive: /UserManagementSolution.root/UserManagementSolution/UserDAL/Tems.cs $
//$History: Tems.cs $
//* *****************  Version 3  *****************
//* User: michaelc     Date: 1/31/13    Time: 9:44a
//* Updated in $/UserManagementSolution.root/UserManagementSolution/UserDAL
namespace UserDAL
    public class Tems

The Version along with the two lines following it are placed by VSS. I was aware that VSS placed the history according to where one places the lines:

//$Archive:  $
//$History:  $

Note that VSS also places the VSS file information in the $Archive and $History paras. Just use dollar signs as shown to tell it where this information goes.

However, when I actually checked in the code (about 20 C# files), VSS put the history in WITHOUT comment characters, and thus broke the build. This required some annoying rework to comment the lines. The question is, how do I make VSS comment the history when it puts it in?

1 Answer

  1. Laurent- Reply


    I spent some time pondering the problem, then suddenly remembered that there was some coding required in the srcsafe.ini file to tell VSS put the history in commented lines.

    I located the srcsafe.ini file of a project that was behaving as desired, and compared it with the one for my new project. I found the following lines in the correctly-behaving .ini file:

    Keyword_Masks = *.cs, *.sql
    Shadow = 
    [Keyword Comments] 
    *.cs = "//"
    *.sql = "--"

    The Keyword_Masks and Shadow keywords are placed in the .ini file after the UseHelperService. I suppose the Keyword_Masks (with comma-separated values) tell VSS which file types to place the history (I don't know what Shadow signifies, but since it occurs in all of our projects I didn't want to omit it and find out it caused something subtly wrong later).

    The new [Keyword Comments] section occurs immediately afterwards (and before the [Timezone] section. This obviously tells VSS which characters to use for line comments, and for which file type.

    And that did it!

    Note that if you're using Visual Basic, this will be coded as *.vb. Obviously. And you don't have to include Sql; in this case our VSS project happened to contain solution and project files with stored procedures that we were also keeping in VSS.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>