Setting Up Source Control with the Microsoft Development Environment

   

Once you set up Microsoft® Visual SourceSafe™, you can perform several steps to integrate it with the Microsoft development environment. With this integration, you can use the environment to track item versioning, renaming, deleting, and more. First steps to integrating the development environment with your Visual SourceSafe database include:

Choosing the Client or Server Installation of Visual SourceSafe

When you first install Visual SourceSafe, you have two options:

The server installation is performed once by the administrator of your network. This creates the server's source code control database, to be used by all of your team. The administrator can then add users with the administrator application. (The administrator also needs to install the client application of Visual SourceSafe to the server to use Visual SourceSafe.)

The client installation is for all the local machines that are going to access the master source code control database. The database server itself also needs to include the client installation if the administrator wishes to run Visual SourceSafe and access the files on that machine. The client application works with the development environment to give you access and control over your source control files.

The administrator can setup Visual SourceSafe to provide a way for local users to install the client application over the network from the server's location. This process, called netsetup, provides the database location information to the client application.

When you install Visual SourceSafe, select the "IDE Integration Option" to incorporate the Microsoft development environment. For more information on installing Visual SourceSafe, see the Visual SourceSafe documentation.

Finding or Connecting with the Visual SourceSafe Database Server

You may want to reestablish a connection with the source code control database because you:

If you need to find the initial connection to your source control database, see Changing/Setting a Connection to the Source Control Database for more information and step-by-step instructions.

In the next two cases, if you need to reconnect to the source code control database, you can use the Change Location command on the development environment Project menu (in the Source Control submenu) to change the connection.

If the name of your database project changes, you can use the Change Location command to link your local copy of source code control with the current source control server.

If you must work offline, you can Check Out the items you want (or Get the latest versions) and then go offline. This feature disables any further messages about a lost connection with the source control server. When you reconnect, you can change this to online and Check In your files.

Mirroring Your Development Directory Tree in Visual SourceSafe's Project Structure

A typical source code control network assumes that all the files are kept in one master source code control database on a server, linked to the developers' computers by a network link. The master database is where you store the original information, such as code and documentation, and the individual computers are where you edit and compile the files.

Your hard drive is organized into a directory tree, usually with a root directory labeled c:\ and folders or subdirectories such as c:\res\icons. The Visual SourceSafe database is organized in a very similar manner — in a project tree. The project root is labeled $/ and it can contain subprojects such as $/Resources/Icons. Visual SourceSafe projects and subprojects are organized similar to the directories or folders on your machine's hard drive.

When you work on a project in Visual SourceSafe, you associate a local directory path name, or Working Folder, with that project (this is known as the "working directory" for the project). This local directory path name, such as D:\projects\proj1\res\icons, can mirror the structure of the Visual SourceSafe project, $/Project1/Resources/Icons. This path name can be customized for each user and loosely correlates with the Visual SourceSafe project. Another developer can set up their own machine to access the same Visual SourceSafe project with a local directory path of C:\projects\proj1\graphics, and point to $/Project1/Resources/Icons.

If you are just starting out with Visual SourceSafe, a good strategy is to map the project layout in the source code control database to mirror the names and hierarchy of the usual development directory tree. This makes the associations recognizable. You can add shared files and branching later. The development environment will populate the directory tree from the solution when you first check in the solution.

Adding Projects or Solutions to the Source Control Database

You can add projects or solutions through the development environment with the Add to Source Control command. When you add a solution to source code control, all the projects in that solution can be added as well. This is useful when you have a large number of projects to add to source control at once.

The first time you open a project in source control, you use the New Project command (on the File menu) and click Source Control to get to the database. Afterward, the development environment remembers the location of the database for you.

When you first join a team that is working on a source control project, you need to get current copies of all the source control files used by your team. To retrieve copies of the files from the database to your local machine, Open the project and click Source Control. You can use the Get command to retrieve the latest copies of the files to your local machine.

Visual SourceSafe supports a "branch" (forking) function, where you create a new version of a project. This command cannot be performed from within the development environment (only within Visual SourceSafe). However, if you do branch a project, the development environment's last known location for the project will not match the new location. To resolve this, you should use the Change Connection command to modify the source control connection for the projects in the solution, and check that in immediately. Other people can then use Open Project (Source Control menu) to open the new project.