Visual Source Safe

Introduction to Visual Source Safe

Visual Source Safe, generally called as 'VSS', is the source control system from Microsoft. This tool was originally developed by another company and later taken over by Microsoft.

Microsoft recently developed a team collaboration tool called "Visual Studio Team System" (VSTS). This tool allows source control management and several other software development management tools. Microsoft will be promoting VSTS in future instead of VSS. However, next few years, VSS will still be the most popular source control system due to it's easy to use user interface, simple configurations and availability of experienced users.

Visual Source Safe is available as part of Visual Studio .NET products. The following are the various versions currently in use by majority of the development teams:

1. Visual Source Safe 5.0

2. Visual Source Safe 6.0

3. Visual Source Safe 2005

Visual Source Safe 2005 is available as part of the Visual Studio 2005 suite of products. However, when you install Visual Studio .NET, this tool is NOT automatically installed. You must select this product from the installation CD and install separately.

Installing Visual Source Safe

The steps involved in setting up the Visual Source Safe source control for your team are explained below:

Step 1: Install VSS from the setup CD.

Every member in the team must install the VSS software on their computers. The installation is very straight forward just like any other windows installation program.

Step 2: Create a VSS Database for your project

Every team (or product) will need a separate VSS database. This step is done using the VSS Admin software. When you install VSS software, it will install the Admin software as well as client software on your computer. Choose 'Visual SourceSafe Admin' from the start menu.

When you launch the admin software, it will automatically connect to a default database called 'Microsoft Visual Studio'. This is the name of a database automatically created on your computer when VSS is installed. However, usually nobody use this vss database for any purpose. Instead, after connecting to this default database using the VSS Admin tool, you will create a new database for your team.

To create a new database, go to the 'Tools' menu and select 'Create Database'. You will be prompted to browse to a folder to create the new database. All you have to do is, select a folder and press 'OK'. This will create a new database.

Even though this process created a new database for you, your VSS Admin tool is still connected to your default database called 'Microsoft Visual Studio'. To connect to your new VSS database, select the 'Users' menu and select 'Open SourceSafe Database'. This will show you a small dialog box with the list of previously connected databases. Since you have not yet connected to your new database, it will not be listed. So, press the 'Browse' button to search for the new database. Using the folder browser, you can navigate to the folder where you just created the new database. Inside the folder, you will see a file called 'SourceSafe.ini'. This is the database file you need to connect to. Select this file and press 'Open'. This will connect to the new database.

Step 3: Create users

After you connect to the new database, you will see the list of available users. There are 2 users created by default:

1. Admin

2. Guest

Delete the Guest user. You do not want other people to connect to your secure vss database.

Also, change the password for admin user. By default, there is no password for this account. To change password, select 'Admin' user in the list and select 'Change Password' option from 'Users' menu.

Now, select 'Add User' from 'Users' menu. This will show a dialog box where you can specify the user name and password.

If you are part of a "domain" in your company network, remember to choose the user name same as the 'network login id'. Password can be different. If you choose the vss user name same as domain user account, the user will not be prompted to enter password each time they try to connect to VSS from their computer. Create a user for all members in your team. When you create users, leave the database as blank. Each user can connect to this database and then change their password.

Connecting to VSS Database

After creating the vss database, users can connect to it.

To start using VSS software, open 'Visual Source Safe' from the Programs Menu. By default, it will connect to the default database called 'Microsoft Visual Studio'. To connect to another database, select 'Open SourceSafe Database' from 'Users' menu. This will prompt you to select a database from the list.

If your database is not listed, you must select 'Browse' button and navigate to the folder where VSS database is created. When you open the folder where database is created, you must select a file called 'SourceSafe.ini' from the folder.

If your VSS database is installed on another computer, you must map a network drive to the shared folder on the other machine where the database is created. Then select the mapped drive from the drop down in the 'Find Database' dialog.

Select appropriate drive and navigate to the folder where VSS database is created. Select the file 'SourceSafe.ini' from the folder and press 'Open' to connect to the database.

When you connect to the database, you will see an explorer like view in the Visual Source Safe

On the left pane, you will see a tree view. There is only one node in the tree and it is named '$'. This represents the root folder of your project. You can create folders and add files to it.

Microsoft Visual SourceSafe, also called ‘VSS’, is a file-system-based source control tool from Microsoft. This tool was originally developed by One Tree Software Company and later taken over by Microsoft.

Add

Get

Check Out

Check In

I only put basic introduction of SourceSafe / VSS operations in this post. For detailed information about SourceSafe operations, like Add, Get, Check In and Undo, please refer to the upcoming posts.

Add

Add is the starting point of all VSS file operations. Before you can do Get, Check In, Check Out or other operations, the file needs to be under the control of VSS first.

You can add individual files and folders into VSS database.

Screen shots of Add File:

(Screen shot: Add File in VSS 6)

(Screen shot: Add File in VSS 2005)

Get

When you want to view/get a file or project, but not modify it, you can use the Get or View command. Get copies the file or project from the current project into your working folder.

Get Latest Version, which retrieves the most recent version of a file or a project to your working folder, is the most commonly used command in VSS.

Screen Shot of Get:

(Screen shot: Get Latest)

Check Out

To make changes to a file you must first check it out of the VSS database. When you Check Out an item, VSS retrieves the latest copy of the file to your working folder and make it writable.

There are exclusive check out and non-exclusive check out. If a file is checked out exclusively, it cannot be checked out by other users.

Please always check out a file first before making any changes for the following reasons:

If a file is not checked out, it cannot be checked in;

If a file is not checked out, your local copy may not be the latest copy. Not working on a latest copy may cause extra work, overwriting other’s changes, confusion and many other problems;

If we change a file without checking it out first, other team members can check out the file and make changes to it, which can cause huge problem if parallel changes to a file is not desired.

This is the classical lock-modify-unlock model of VSS. Other tools like CVS and SubVersion have very different models. The latest VSS 2005 also supports the Copy-Modify-Merge model. We will discuss the details later in the coming articles.

Screen shot of Check Out:

(Screen shot: Check Out)

Check In

After you have finished the changes, you need to Check In the updated file back into VSS. When we say VSS keeps all your previous changes, we are not saying that VSS keeps every change you make, we are saying that VSS keeps all the versions you checked in. If you do not check in your file, there is no way that VSS knows that you have changed the file and it should keep it.

Screen shot of Check In:

(Screen shot: Check In)

File Diff in SourceSafe / VSS

Why File Diff

File Diff is one of the important features that we use with a version control system. File Diff compares two files and shows the differences. With these differences, we can better track the modification of our code or documents.

What File Diff can do

File Diff can compare:

  • A local file and a source-controlled file.
  • Two local files.
  • Two source-controlled files.
  • Two versions of a source-controlled file.

For the first three situations, we can launch Difference Options by right clicking on the file list pane and selecting Show Differences…

(Launch Difference Options)

In Difference Options, we can specify the two files, local or source-controlled.

(Specify the two files for comparison)

To compare two versions of a source-controlled file, we can launch Difference Options in the History window of the source-controlled file.

(Launch Difference Options in History)

For binary files, File Diff can indicate if they are identical but cannot show the differences.

How File Diff works

File Diff compares the two files line by line.

  • If a line exists in the first file only, SourceSafe indicates this line as deleted.
  • If a line exists in the second file only, SourceSafe indicates this line as added.
  • If a line in both two files has different contents, SourceSafe indicates this line as changed.

Example of File Diff

For example, we have an original file with the content:

111

222

333

444

555

666

After we make the following changes:

Added ‘000′ before the first line

Changed 2nd line from ‘222′ to ‘aaa’

Deleted the 4th line

We get the current file with the content:

000

111

aaa

333

555

666

For the diff result: