Click here to Skip to main content
15,885,278 members
Articles / Programming Languages / C#
Article

C# Wizard Templates Integrated with SourceSafe

Rate me:
Please Sign up or sign in to vote.
3.00/5 (7 votes)
14 Aug 2005CPOL3 min read 38.3K   19   3
I was looking for some solution that may be helpful in creating Code Templates to be used across the development team(s) and that can also maintain the versioning/revision history as well as provide integration with SourceSafe.

Introduction

I was looking for some solution that may be helpful in creating Code Templates to be used across the development team(s) and that can also maintain the versioning/revision history as well as provide integration with SourceSafe.

Background

After surfing The Code Project, I found Building VS .NET Wizards - Part 1 by Michael Groeger (thanks); this article helped me reach the solution for creating the templates. Still the idea was not complete. As I mentioned earlier, I wanted the solution to be integrated with SourceSafe to maintain versioning/revisions. I have gone through MSDN and found the working of SourceSafe with code and hence the Wizard Templates are attached.

Using the Code

The usage of these templates is really very easy and the two steps work as follows:

  1. Simply backup your folders from <VisualStudioDir>\VC#\VC#Wizards
  2. Copy the New Wizard folders to the above mentioned folder

You are done.

Open Visual Studio .NET 2003 and use any of the following Wizards; you will see the difference.

  • CSharpAddClassWiz
  • CSharpAddReportWebServiceWiz
  • CSharpAddUserControlWiz
  • CSharpAddWebFormWiz
  • CSharpAddWebServiceWiz
  • CSharpAddWinFormWiz
  • CSharpAddWinServiceWiz
  • CSharpClassWiz
  • CSharpConsoleWiz
  • CSharpWebServiceWiz
  • CSharpWindowsServiceWiz

SourceSafe Integration

For SourceSafe configuration, follow the steps mentioned below.

You need to have SourceSafe configured at some machine accessible from your development machine. Use this article from the Microsoft Web site to learn more about how to configure SourceSafe to work with Versioning your code file.

Keyword Expansion

To integrate VSS with Visual Studio, you need to use Keyword Expansion. Keyword Expansion refers to the ability VSS has to replace certain sections of files with information relevant to the file such as the last time it was modified, who modified it or the date and time the last check in operation occurred. Typically, you will want to place the keywords in commented sections of code at the top of your source files so they do not affect compilation. Here is a quick table of all the VSS keywords and what information they provide.

Note: Keywords are case-sensitive, so be sure to capitalize them properly.

KeywordInformation Provided
$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

VSS will add comments to your code at check in time if configured to do so in srcsafe.ini. This is useful because it shows a nice file history right in the file header and, if the comments are added during check in, describes the nature of each change.

Now to provide this functionality, you need to add the following lines to srcsafe.ini. (Please note that this file is located at the server where SourceSafe is configured.)

Keyword_Masks = *.cs, *.htm, *.html, *.aspx, *.ascx
;updates keywords in a user's working directory with the new keyword information
;when a user updates or checks in a file.
Expand_Keywords_Locally = YES

[Keyword Comments]
*.cs = " /// "
*.aspx = " -- "
*.ascx = " -- " 

Now, you are done with SourceSafe integration.

History

I wanted to create an MSI to install this but could not spare time for this. Please provide me feedback after using the templates. Remember you can always modify the contents of the files as per your needs. Just a simple mail letting me know about you and your experience will be appreciated.

You can also discuss the article here.

History

  • 14th August, 2005: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Product Manager
Pakistan Pakistan
Having 20 years of experience developing innovative software targeting multiple industries including, EDA, Insurance, Supply Chain, Support Centers, CRM, Brain Storming (Mind Mapping); Muneeb is a developer turned project manager, who thinks he can still code and finds some time to keep himself abreast on latest trends and best practices—to implement them while managing the projects making the clients happy by ensuring timely deliverables of their expectations.

Comments and Discussions

 
GeneralMRB Prefix Pin
NTulip15-Aug-05 1:52
NTulip15-Aug-05 1:52 
GeneralRe: MRB Prefix Pin
Muneeb R. Baig15-Aug-05 2:14
Muneeb R. Baig15-Aug-05 2:14 
GeneralRe: MRB Prefix Pin
NTulip15-Aug-05 2:20
NTulip15-Aug-05 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.