Visual SourceSafe® has become every Windows® developer’s companion as regards maintaining his or her code as well as, a means to keep track of the various versions of his or her development. This makes his or her life a lot simpler, and avoids the unnecessary usage of his or her disk space.
I would like to share with you folks a unique way of using this invaluable tool through your favorite development environment. Yes, it is very much your own Visual C++ Version 6.0 IDE. So, just tie up those walking shoes, and follow me.
Configuring VSS from the VC++ environment
Start the environment by invoking
msdev.exe from the
Run prompt. After the environment is open and ready,
- Select Tools->Options.
- Select the Source Control tab from the Options dialog.
Fig. 1 Options Dialog
- Tick the checkboxes as shown in figure 1 above. Enter a login ID in the edit box Login ID.
- You need to consult your VSS Administrator, before using the "Advanced" options through the "Advanced" button.
- Click OK to accept the settings.
After you make the above settings the VC++ IDE will automatically prompt you to save your newly created workspace in VSS each time you create one.
How to add a new workspace to VSS
After you create a new workspace using the AppWizard, you will get a message as shown below:
Fig. 2 Visual C++ message, to store a project in VSS.
Click the ‘Yes’ button, to store the newly created workspace in VSS. You will see the Visual SourceSafe Login dialog, which will prompt you for the Login ID, Password and the VSS Database path.
Fig. 3 The VSS Login dialog.
Please enter your Login ID (the one you had entered while configuring VSS). You need to consult your VSS Administrator for your Password and VSS Database entries. After you have done so, click on the Browse button to select the path of your VSS Database. You will be able to do so using the dialog shown below.
Fig.4 Dialog to select VSS database.
Click the browse button to select the path of the database file
srcsafe.ini using the Find Database dialog.
Fig. 5 Select your VSS Database path using Find Database dialog
After you click Open button, you will be asked to confirm this path as shown below.
Fig. 6 Confirm the path of VSS database.
Select OK to confirm, or Cancel to recheck the VSS database path. After you have confirmed the path. You will see this path in the Available databases: list. Click the Open button to open the VSS database. You will be again prompted to confirm your LoginID, Password and Database path by the VSS Login dialog. Click the OK button to accept the information or Cancel to exit.
Fig.7 Your database path is added to the Available databases list
After you click OK, you will be prompted to create a new Project folder under your VSS database path, through the Add to SourceSafe Project dialog as shown in Fig. 8 below.
Fig. 8 Add your project to the VSS database tree from here.
Click OK to accept the default Project name as the name of the folder where the project will be saved under your VSS database tree. After you have done so, you will be prompted by VSS to confirm the creation of this folder, as it does not exist as yet, under your database tree. This is done as shown in Fig. 9 below.
Fig. 9 Confirm creation of the new folder in your database.
After you click ‘Yes’ button to accept the creation of the folder you will be allowed to select the files in the project, which you want to store in VSS through the Add to Source Control dialog.
Fig. 10 The list of project files which will be stored in VSS.
By default, VSS selects all your files for storing; you may remove the ticks from any files which you do not want to store in VSS. You may add your comments in the Comment edit box.
The selected files are
Checked Out by default, to allow modifications. You need to remove the tick against the Keep checked out check box, in order to make the files read only. Click the OK button to move the files to VSS and you are done with it.
How to start your business with VSS from within the environment
Your business with VSS is a few clicks away. In order to achieve that you need to follow the following steps.
Steps to start using VSS
- Right click the VC++ IDE’s toolbar. You will see the popup menu as shown in fig. 11 below.
- Select Source Control option from this menu.
- You will notice a new toolbar Source Control, as shown in Fig 12.
- You can use VSS from this toolbar. The details are described in the next section.
Fig. 11 Popup menu to select VSS option
Fig. 12 VSS toolbar
Source Control toolbar (from left to right in the image).
Get Latest Version: Retrieves a read-only copy of the selected VSS items.
Check Out: Copies the latest version of one or more selected files from the current project into your current working folder.
Check In: Updates VSS with changes made to a checked-out file, and unlocks the VSS master copy.
Undo Check Out\; Cancels a Check Out operation, undoing all changes. You must have a working folder set for this command to work properly.
Add To Source Control: Invokes the Add to Source Control Dialog shown in fig 8.
Remove From Source Control: Removes the project from VSS.
Show History: Shows the history of a file or project in VSS.
Show Differences: compares the local copy of your code file to the one in VSS, and shows how they differ (in a text display).
Source Control Properties: This will invoke a dialog as shown below, when you select one of your code files.
Fig 13 Dialog shows the properties of a file in VSS.
Share from Source Control: VSS projects are in many ways analogous to operating system folders. However, whereas every file in an operating system exists uniquely in a folder, a VSS file can simultaneously exist in many different projects.
In VSS, you can share files. Inside the VSS database, there is only one copy, the master copy, of the file; each project to which the file belongs simply has a pointer to that copy. When you change the file in any one project, VSS immediately updates it in all the projects that share it. For more information on Sharing of projects and files please see Share Files in your MSDN documentation.
Refresh Status: Refresh the status of your project files.
Source Control: This will execute the Visual SourceSafe software.
You can also use the Project->Source Control menu item to use the above functionality.
Some useful tips
How to know whether your files are checked in or checked out:
If you open your workspace and select the File View tab of the workspace window, you will notice that the files are all marked in gray color, which means that your workspace is checked in. This is a confirmatory test to know whether your files are checked out or checked in.
Fig 14 File View indicates checked in files.
How to know whether a particular file is checked out or checked in:
To know the status of a file, i.e. whether it is checked out or checked in, just open the file and right click on the open file, and select ‘Properties’ from the popup menu. You will get the following dialog:
Fig. 15. Dialog indicates the status of a file in VSS.
You will be able to notice the status of the file inside the ‘Status:’ edit control. An alternative way to know this information is to look in to Class View tab of your workspace window. If both the header file (.h or. hpp) and code file (.cpp or .c) are checked out, you will see a red tick associated with the particular C++ class. If only one of them is checked out, then you will see a black tick associated with the particular C++ class that is checked out.
It is very simple and effective to use VSS from your development environment, rather than opening the VSS software separately. I hope this approach will surely improve your efficiency as regards usage of VSS, as well as encourage you to do source-safing from the VC++ development environment.
Happy Source-safing all the way!!!<!------------------------------- That's it! --------------------------->