Introduction
Visual SourceSafe 2005 (VSS) is a source or version control system implemented as a client/server application creating a virtual library of files which acts as storage file system. This virtual library can be accessed through the VSS client tools (VSS windows client, VSS command-line tool) and plug-in embedded in development environment such as the VSS plug-in for Visual Studio.NET. In this article, I will show how two developers can work together in a Visual Studio.NET project to cooperatively develop a solution using the LAN plug-in for Visual Studio.NET integrated with this IDE.
Using Visual Sourcesafe
In order to illustrate the concepts and techniques to use Visual SourceSafe integrated with Visual Studio.NET, we're going to consider the following scenario in which two developers, with the VSS tools installed on two development machines (development1, development2), have to cooperatively develop a solution in Visual Studio.NET 2005 and for the source control they use Visual SourceSafe 2005 LAN plug-in to connect to a development server (named developmentserver).
In order to create the VSS database in the developmentserver, you must go to the machine developmentserver.
Open the Visual SourceSafe Administrator application, go to the File | New Database menu in order to launch the Add SourceSafe Database Wizard, and then click on the Next button. In the New Database Location page, browse to the location where the VSS database will reside, and click on the Next button (see Figure 1).

Figure 1
In the Database Connection Name, you have to type a name for the database (see Figure 2).

Figure 2
In the Team Version Control Model page, select the default settings, and click on the Next button to finish with the wizard (see Figure 3).

Figure 3
After that, the VSS database is created, and you can manage this database using the VSS Administrator. For example, let's add a two VSS user to the database, by going to the Users |Add User menu and typing data to the required fields (see Figure 4 and Figure 5). This enables VSS to handle its own authentication process rather than integrating with Windows authentication through file access and NTFS permissions.

Figure 4

Figure 5
Now in the developmentserver machine, we have to define the solution to be developed and its structure, and then upload this solution to the VSS database.
In order to create the solution and Console Application project, you have to go to the File | New | Project menu (see Figure 6) and select the appropriate items.

Figure 6
When the solution is created, you have to add the solution and the Console Application project to the VSS control system (see Figure 7).

Figure 7
The Log-on VSS database page will appear, and you have to enter the appropriate username and password (see Figure 8).

Figure 8
The Add to SourceSafe window is launched and you have to click on the OK button to successfully include the project in the VSS database (see Figure 9).

Figure 9
Initially, the files are in checked-out state (indicated with a small red check mark on the left-hand side of the file icon). If you want to check in this file, go to the Solution Explorer and right-click on the project node and select the Check-In option to launch the Check-in window (see Figure 10).

Figure 10
The checked-out state is indicated with a small blue padlock on the left-hand side of the file icon (see Figure 11).

Figure 11
Now let's go to the development1 machine, and open Visual Studio.NET 2005 IDE. Go to the File | Source Control | Launch Microsoft Visual SourceSafe menu to open the Visual SourceSafe Explorer to add the VSS database (see Figure 12).

Figure 12
The Add SourceSafe Database Wizard is launched. In the Database Selection, select the Connect to an existing database option and click on the Next button (see Figure 13).

Figure 13
In the Share Location, you have to browse to the location where the VSS database resides and click on the Next button (see Figure 14).

Figure 14
In the Database Connection Name, you have to enter a descriptive name for the VSS connection and click on the Next button to finish with the wizard (see Figure 15).

Figure 15
Open the Open Project window by using the File | Open | Project/Solution menu. Then, click on the SourceSafe (LAN) button on the left, and select the TestProject item (see Figure 16).

Figure 16
The Log On to Visual SourceSafe database window appears in order to enter the username and password for the database (see Figure 17).

Figure 17
Then navigate to the solution file in the VSS database (see Figure 18).

Figure 18
Click on the Open button to download the solution into the Visual Studio.NET (see Figure 19).

Figure 19
Now let's do the same operations in the development2 machine.
Now it's time to develop the solution using Visual SourceSafe tools by adding new classes, and building the solution. As illustrative purposes, the developer 1 and developer2 will develop the Calculator class which is responsible to implement basic arithmetic operations.
In the development1 machine, right-click on the project, then choose Add | New Item and select the Class item (see Figure 20).

Figure 20
You can see that the project node is checked-out mode (indicated by a red check mark on the icon) because it has been changed. The newly added Calculator.cs file is represented using a yellow plus sign on the icon (see Figure 21).

Figure 21
Now let's implement some functionality of this Calculator class (see Listing 1).
using System;
using System.Collections.Generic;
using System.Text;
namespace TestVSS_ConsoleApp
{
public class Calculator
{
public int Add(int nValue1, int nValue2)
{
return nValue1 + nValue2;
}
public int Product(int nValue1, int nValue2)
{







gabrielbalojieditedPosted Jun 23, 2009, 3:02 PMEdited Jun 23, 2009, 3:04 PM
Good article. Simple and easy to follow.