Special Edition Using Microsoft® Visual Studio for Enterprise Development

Previous chapterNext chapterContents


- 26 -
Using Visual SourceSafe

Learn what Visual SourceSafe is about and why and when to use it.
Learn how to install Visual SourceSafe and use the Visual SourceSafe administration program to maintain and configure the installation.
Learn how to use Visual SourceSafe Explorer to manage your project source code with various source control and version tracking tools.
Learn how to use source control and version tracking tools in Visual SourceSafe to help manage and develop a large-scale web site just like any other software development project. You will also learn how to use several new web-specific features available in Visual SourceSafe version 5.

Many large software development projects involve teamwork and last over an extended period of time. Developers involved might come and go through the course of a project, and the person who coded a particular section of the program might not even be around later on. Additionally, many large projects are developed on a phased basis, and various versions of the software are released over time. One of the biggest challenges in managing a development project with such complexity and coordinating large teams of developers working together is keeping track of the changes made to the source code. The larger the project is, the more difficult the task. The following are some typical problems a development team often has to deal with:

Microsoft Visual SourceSafe provides just the right tools for solving these problems. Its source control mechanism offers the advantages of easy and efficient team coordination and version tracking without adding a new burden to developers, and it will be useful to any team development environment. This chapter describes the fundamentals of using Visual SourceSafe 5.0.

Introduction to Visual SourceSafe

Visual SourceSafe is a project-oriented version control system. It provides two primary benefits to your software development process:

When multiple developers are working on one project, it is important to have a source control mechanism. It helps ensure that only one developer is working on a particular piece of source code at any given time so that one developer does not overwrite another developer's work. Alternatively, you can have simultaneous editing and let Visual SourceSafe automatically merge the changes made by different developers and keep the developers in sync with each other's changes.

With versioning capability, anyone can re-create an earlier version of the software, as needed. This becomes necessary when you need to re-create an old build or to create a new branch of the application.

In addition to the standard benefits of using Visual SourceSafe for source control and version tracking in software development for any size team, Visual SourceSafe offers some new web features for managing web site development projects.

You can work with Visual SourceSafe in one of the following three ways:

This chapter focuses only on the graphical user interface.


NOTE: For Visual Basic, Visual C++, Access, Visual J++, FrontPage, Visual InterDev, and Visual FoxPro, SourceSafe works directly integrated into the environment. You can check files in and out of Visual SourceSafe by using menus inside the IDE. For more information, see the documentation and online Help for those products.

Why Use Visual SourceSafe?

Compared to older, UNIX-based version control systems, Visual SourceSafe has two unique features. First, its architecture is project-oriented rather than file-oriented. It keeps track of not only the changes made to each and every file but also the relationships among files. The key concept in understanding how to work with Visual SourceSafe is the idea of a project. A project is a collection of interrelated files that you store in Visual SourceSafe. You can add, delete, edit, and share files within and among projects. Second, its Windows 95 Explorer-like interface makes it easy to use. So Visual SourceSafe actually helps the developers spend less time doing source code "bookkeeping" and more time programming.

Visual SourceSafe uses the "reverse delta" technique to keep track of project changes. That is, it stores only the latest and greatest version of each source file in the project as one complete version plus all the changes required to go back to the previous versions. This ensures that storing old versions takes only a minimum of disk space and you can access the current version immediately. Because the changes are not stored as files, there is no way to delete them, thus making Visual SourceSafe more reliable.

SourceSafe stores its contents like a database in its DATA directory, but only SourceSafe has access. Two files are created for each file and each project in SourceSafe, and they are stored in a subdirectory of the DATA directory. One of the two files is called the "Log" file. It does not have an extension. This is where SourceSafe information and differences between one version of the file and the next are stored. The other file is called the "Data" or "Tip" file. It has an extension of either .A or .B, and it stores the most recent version of the file or the project.

A Visual SourceSafe Network

A Visual SourceSafe network typically consists of a centralized Visual SourceSafe database on a server and several client workstations. The shared Visual SourceSafe database is where you store and track your code. To actually work on a file within Visual SourceSafe, you must obtain a copy of the file from Visual SourceSafe and place it in a working folder of your own. The Visual SourceSafe database is organized into a project tree with various projects and subprojects under a root project ($/). Visual SourceSafe associates every project with a working folder. You cannot choose a different working folder for each file in a project. However, each individual user can, and should, have a separate working folder for each project. This is a user-by-user setting.

Administering Visual SourceSafe

As the administrator of a Visual SourceSafe installation, you are responsible for setting up, configuring, and maintaining the installation. This section describes how to install Visual SourceSafe and use the Visual SourceSafe administration program for basic configuration and maintenance.

Setting Up and Installing Visual SourceSafe

The program SETUP.EXE is provided with the Visual Studio 97 CD-ROM to install Visual SourceSafe 5.0. During the installation, the Setup program checks your system and asks what type of installation you want to have. The typical way of setting up Visual SourceSafe is to have a server installation on a network drive and a client installation on each workstation. Although the server setup is all that is actually required, having only a server setup can generate large volumes of network traffic. Figure 26.1 shows the Setup program installation choice screen.

FIG. 26.1
Three options are available from the Visual SourceSafe installation choice screen: Server, Custom, or Client setup.

When you install Visual SourceSafe, you need two components--the Visual SourceSafe Explorer interface and the Visual SourceSafe database, which holds your project files and version information. Both are needed to use Visual SourceSafe. The following are the three installation options:


NOTE: The Custom option is the only way to install Visual SourceSafe database on your hard drive and then have it accessible for integration with Visual Basic and Visual C++. Also, you can use this option to add administrative programs such as Visual SourceSafe Administrator to a client installation.


TIP: During a server installation, the setup program puts a copy of the NETSETUP program in the folder in which Visual SourceSafe is installed on the server. You can double-click NETSETUP to perform a network client installation instead of a client setup from disk.


CAUTION: Visual SourceSafe installation places all the Visual SourceSafe files and several subdirectories (for example, WIN32, USERS, and DATA) under the main Visual SourceSafe directory, as in a database. Only the Visual SourceSafe program can create, modify, and delete files in those directories. Users should never manually change anything in those directories. All file storage is in proprietary Visual SourceSafe formats, and any change could cause unpredictable results or loss of data.

Running Visual SourceSafe Administrator

Visual SourceSafe Administrator is the administration program provided for configuring and maintaining the Visual SourceSafe installation.

To start Visual SourceSafe Administrator,

1. Click the Start button.

2. Point to Programs.

3. Click the Visual SourceSafe 5.0 Admin.

The Visual SourceSafe Administrator main window displays as shown in Figure 26.2.

FIG. 26.2
The Visual SourceSafe Administrator program allows the administrator to configure and maintain the Visual SourceSafe installation.

In a new installation, no password is set for the administrator. Because Visual SourceSafe security is controlled from inside Visual SourceSafe Administrator and any user who can access that program can basically do anything within Visual SourceSafe, one of the first tasks of the administrator should be to assign a password to the Admin user. You can do this by using the Change Password command on the Users menu as shown in the section "Maintaining the User List" later in this chapter.


CAUTION: Write the password down in a safe place! If you forget the administrator's password, contact Microsoft Technical Support Services for help. You cannot reassign a new password by running Visual SourceSafe Administrator without knowing the old one.

Maintaining the User List

As a Visual SourceSafe administrator, you are responsible for maintaining the list of Visual SourceSafe users. You can use the Users menu in the Visual SourceSafe Administrator window to add, edit, or delete users and to change a user's password.

To add users,

1. Select Users, Add Users from the menu.

Visual SourceSafe Administrator displays the Add User dialog box, as shown in Figure 26.3.

FIG. 26.3
To add a user to the database, use the Visual SourceSafe Administrator Add User dialog box.

2. Type a name in the User Name box and a password in the Password box.

Usernames can be up to 31 characters long, cannot begin or end with a space, and cannot include any of the special characters such as $, @, *, !, ?, ^, =.

Passwords can be up to 15 characters long and can contain any characters. Usually, they are initially set to something simple, such as the username, and the user is instructed to create a new password from within Visual SourceSafe.

3. To give the new user read-only rights, check the Read Only box. If this box is unchecked, the new user has read-write rights by default.

4. Click OK.

When you add a new user, Visual SourceSafe automatically creates an SS.INI file for that user based on the default SS.INI template in the \VSS\USERS\ADMIN folder. You can modify this template file to create a different default SS.INI file for each new user. For information on how to set security by user and by project, see the section "Setting Up Rights for Project Security," later in this chapter.


NOTE: The Visual SourceSafe database is the central database in which all master copies, history, project structures, and user information are stored. A project is always contained within one database; multiple projects can be stored in one database, and multiple Visual SourceSafe databases can exist to store multiple projects. Each database is associated with a SRCSAFE.INI file. For security reasons, Visual SourceSafe's list of users and passwords is stored with a particular Visual SourceSafe database. This can be an advantage if security is the reason you want to install separate SourceSafe databases; however, to add a user to multiple Visual SourceSafe databases, you must add the user to each individual database.

To change a user's password,

1. Select a user from the Visual SourceSafe Administrator user list.

2. Choose Users, Change Password from the menu.

Visual SourceSafe Administrator displays the Change Password dialog box, as shown in Figure 26.4.

FIG. 26.4
The Visual SourceSafe Administrator Change Password dialog box is used when a user forgets his Visual SourceSafe password.

3. In the New Password box, type a new password. (You do not need to know a user's old password to assign a new one, and Visual SourceSafe passwords are not case sensitive.)

4. In the Verify box, type the new password again to verify it.

5. Click OK.

Visual SourceSafe Administrator changes the password.


NOTE: If a user forgets his or her Visual SourceSafe password, the administrator can use this dialog box to assign a new password, but cannot recover the old one. Visual SourceSafe does not prohibit you from reassigning a previously used password. Keep in mind that the Visual SourceSafe password is not meant to replace or augment your operating system or network operating system password.

As the administrator, you have a special password that is used to run Visual SourceSafe Administrator.


NOTE: As the administrator, you are responsible for controlling the location of the Visual SourceSafe database, the user list, and the access rights of each user, and for performing setup and backup duties on the database. So be careful with your password.

To change the Admin user's password,

1. Select the Admin user from the Visual SourceSafe Administrator user list.

2. Choose Users, Change Password from the menu.

Visual SourceSafe Administrator displays the Change Password dialog box, as shown in Figure 26.5. The administrator's username is always Admin.

FIG. 26.5
You can change your password in the Visual SourceSafe Administrator Change Password dialog box.

3. In the Old Password box, type the old password.

You must know the old password in order to change it.

4. In the New Password box, type a new password.

5. In the Verify box, type the new password again to verify it.

6. Click OK.

Visual SourceSafe Administrator changes the Administrator password.

To delete users,

1. Select the user(s) to be deleted from the Visual SourceSafe Administrator user list.

2. Choose Users, Delete Users from the menu.

Visual SourceSafe Administrator displays the warning message "Are you sure you want to delete?" (see Figure 26.6).

FIG. 26.6
The Administrator Delete Users dialog box enables you to delete users.

3. Click OK.

Visual SourceSafe deletes the selected user(s).


TIP: If the deleted user has files checked out, a warning is not generated. To unlock those files, run Visual SourceSafe as the Admin user and use the Undo Check Out command.

To edit users,

1. Select the username to be edited from the Visual SourceSafe Administrator user list.

2. Choose Users, Edit User from the menu.

Visual SourceSafe Administrator displays the Edit User dialog box, as shown in Figure 26.7. A shortcut for displaying the Edit User dialog box is to select the username in the Visual SourceSafe Administrator user list and then press Enter.

FIG. 26.7
The Visual SourceSafe Administrator Edit User dialog box is used to change the username and access rights of the selected user.

3. Check/Uncheck the Read Only box to give the user Read-Only or Read-Write rights. You can also change the user login name by typing a new one.

4. Click OK.

Visual SourceSafe changes the selected user's rights and/or login name.

Setting Up Rights for Project Security

Security in Visual SourceSafe is based on user access rights. Default security in a Visual SourceSafe installation offers only two levels of access rights for the new users:

If these two default levels of access rights are adequate for your installation, you do not need to go further. However, some Visual SourceSafe installations require more levels of security control. For these installations, you can enable project security and customize it to allow only specific users to have access to certain projects and certain commands. Four levels of access rights are available in Visual SourceSafe as described in Table 26.1.

Table 26.1  User Access Rights in Visual SourceSafe

Rights Description
Read (R) Read-only access. Users can view files by using commands such as View and Get.
Check Out (C) Read-only plus Check in/out access. Users can modify files by using commands such as Check In, Check Out, and Undo Check Out.
Add (A) Read-only plus Check in/out plus Add access. Users can add files to project and modify the contents of a project using the Add, Delete, and Rename commands.
Destroy (D) Read-only plus Check in/out plus Add plus Destroy access. Users can roll back, purge, or destroy project contents.

To enable project security,

1. Select Tools, Options from the menu in the Visual SourceSafe Administrator window.

Visual SourceSafe Administrator displays the Visual SourceSafe Options dialog box.

2. Click the Project Security tab.

Visual SourceSafe Administrator displays the Project Security tab, as shown in Figure 26.8.

FIG. 26.8
To enable project security, use the Project Security tab in Visual SourceSafe Administrator.

3. Click the Enable Project Security checkbox to enable project security.

4. Under Default User Rights, clear the checkboxes next to the access rights you do not want to grant to the new users.

5. Click OK.

When you activate project security, you enable the security-related commands on the Tools menu: Rights by Project, Rights Assignments for User, and Copy User Rights. You can then assign rights in one of these three ways.


NOTE: When you add a new user and set that user's rights for a particular project, you create an assignment in the Visual SourceSafe database. Any assignment will automatically propagate down the project list until another assignment is reached. When you first add a user, he is given rights in the root project based on the default rights that you have established on the Project Security tab. So a user's rights in the root project ($/) form a set of default rights for that user. These default rights apply to all projects in which you do not explicitly set assignments.

To assign access rights by user,

1. In the Visual SourceSafe Administrator user list, click a user.

2. Select Tools, Rights Assignments for User from the menu.

Visual SourceSafe Administrator displays the Assignments for User dialog box, as shown in Figure 26.9. This dialog box shows all the projects the selected user has explicit assignments in, and what rights he has in each. The effect of propagation down the project list is, however, not shown in this view.

FIG. 26.9
To assign access rights by user, use the Assignments for User dialog box in Visual SourceSafe Administrator.

3. Under Projects, click a project.

4. Click the checkboxes for the access rights you want to assign to the user.

5. Click Add Assignments to display a list of projects to add the users to, or click Delete Assignments to delete rights for the user in the selected project.

6. Click Close.

To assign access rights by project,

1. Select Tools, Rights by Project from the menu.

Visual SourceSafe Administrator displays the Project Rights dialog box, as shown in Figure 26.10.

FIG. 26.10
To assign access rights by project, use the Project Rights dialog box in Visual SourceSafe Administrator.

2. Under Projects, click a project.

3. Under Users, click a user.

Visual SourceSafe Administrator displays the current rights assigned to the selected users in the selected project.

4. Add or delete rights by clicking the appropriate User Rights checkboxes.

5. Click Add User to add a user to the currently selected project. Visual SourceSafe Administrator displays the Add Users for Project dialog box, which contains a list of users who currently do not have rights in the selected project. Click the checkbox next to each right you want to assign the user. Then click OK.

Or click Delete User to delete a user's access to the selected project.

6. Click Close.

To copy one user's access rights to another user,

1. In the Visual SourceSafe Administrator user list, select the user to which you want to copy rights assignments.

2. Choose Tools, Copy User Rights from the menu.

Visual SourceSafe Administrator displays the Copy Rights Assignments dialog box, shown in Figure 26.11.

FIG. 26.11
You can use the Copy Rights Assignments dialog box in Visual SourceSafe Administrator to copy one user's access rights to another user.

3. Select the user you want to copy rights assignments from.

4. Click Copy.

After you copy rights, the two users have identical access rights in every project. If you then change one user's access rights in a specific project, these changes are not duplicated for the other user, unless you use the Copy Rights Assignments command to copy user rights again.

Using SourceSafe to Manage Code

Your source code is a precious resource, and you need to manage this resource properly and effectively. If you are working on a team-based project or a complex system for a customer, it is important to have a source control and version tracking mechanism to help you achieve these goals. Visual SourceSafe provides you with the right tools.

Using Visual SourceSafe Explorer

Many of the actions in Visual SourceSafe take place in the Visual SourceSafe Explorer. Its graphical user interface is modeled after the Windows 95 Explorer for ease of use and logical representation of your project files.

To start Visual SourceSafe,

1. Click the Start button.

2. Point to Programs.

3. Click Visual SourceSafe 5.0.

The Visual SourceSafe Explorer window displays, as shown in Figure 26.12. By default, the window is made up of two panes--the left project pane and the right file pane--as well as the toolbar, status bar, menus, and so on.

FIG. 26.12
The Visual SourceSafe Explorer window is the main user interface of the Visual SourceSafe program.

The left side of the Visual SourceSafe Explorer window shows the project tree with a root project ($/) at the top of the tree. It lists all the projects and subprojects currently under version control and gives a hierarchical display of them represented as folders. Of course, the tree list is expandable and collapsible. A plus sign (+) or a minus (-) sign next to a project indicates the existence of subprojects.

When you select a project on the list, the right side of the Visual SourceSafe Explorer window displays all the files contained in that project and the status information of those files. The Name column displays the names of all files in the project and a file icon next to each file, which provides a visual clue as to whether it is shared by two or more projects or whether it is checked out, and so on. The User column shows the name of the user if the file is checked out. The Date-Time column displays the date/time of the last modification if it is checked in or the date/time when the file was checked out. For checked-out files, the Check Out Folder column gives the folder to which the file was checked out. The current project and working folder fields are shown at the top. Below the project list and file list is the results window for some operations.

Organizing Your Files into Visual SourceSafe Projects

Visual SourceSafe is not only for source code but also for any other files (for example, DLLs, graphics, documentation, executables) you want to keep track of. To use Visual SourceSafe for source control and version tracking, you should store all your files in Visual SourceSafe and organize them into Visual SourceSafe projects.

Visual SourceSafe is project-oriented. Before you can do anything with files, you must have a project in which to place the files. Therefore, when you begin working with Visual SourceSafe, the first thing to do is to create one or more projects and subprojects. For example, you are developing a system called Polaris, and various developers on your team are working on three subsystems: CrossReference, RuleEngine, and TransactionLoader. Under each subdirectory, you might also have several different groups of files. Under TransactionLoader, for instance, you might have two other subdirectories: SQL and Documentation. When you are setting up your projects, it is always a good idea to mirror this directory structure in a Visual SourceSafe project tree. In Visual SourceSafe, you would create a project called $/Polaris. Under it, you would create three subprojects: CrossReference, RuleEngine, and TransactionLoader. Under $/Polaris/TransactionLoader, you would create two subprojects: SQL and Documentation.

To create a new project in Visual SourceSafe,

1. Select the project under which the new project will be created.

2. Choose File, Create Project from the menu in Visual SourceSafe.

Visual SourceSafe displays the Create Project dialog box, shown in Figure 26.13.

FIG. 26.13
The Create Project dialog box in Visual SourceSafe enables you to define projects.

3. Type a name for the new project.

4. Type a comment and describe why you are creating this project.

5. Click OK.

After you create the project tree, you can add your files to the appropriate project or subproject by using the Add Files command.

To add files to a Visual SourceSafe project,

1. Select the project to which the files will be added.

2. Choose File, Add Files from the menu in Visual SourceSafe Explorer.

Visual SourceSafe displays the Add File dialog box, shown in Figure 26.14.

FIG. 26.14
You can add files to your project in the Add File dialog box.

3. Select the files to be added to the project. You can specify a file on any drive and folder, and that file is copied into the current Visual SourceSafe project. You must have the Add access right to use this command.

4. Click Add.

Visual SourceSafe pops up another Add File dialog box for the comment. After you click OK, the files you added no longer appear in the File Name box because they are already part of a Visual SourceSafe project.

5. Click Close.


TIP: Don't keep executable files in Visual SourceSafe projects unless they take a long time to build. Do not take up space in Visual SourceSafe when you can compile and link to build an executable on demand.

Visual SourceSafe associates every project with a working folder. To actually work on a file within a Visual SourceSafe project, you must obtain a copy of the file from Visual SourceSafe and place it in a working folder of your own for that project. Your working folder can be a directory on your hard disk or on a network drive, and it can be an existing folder or a new folder that Visual SourceSafe creates for you. When you set a working folder for a project, you make an assignment for the entire project list, including all subprojects under that project. You can, however, explicitly set a working folder for any subproject. A working folder is set per user, per project.

To set a working folder for a Visual SourceSafe project,

1. Select the project from the project tree.

2. Choose File, Set Working Folder from the menu in the Visual SourceSafe Explorer window.

Visual SourceSafe displays the Set Working Folder dialog box, shown in Figure 26.15.

FIG. 26.15
You must designate a working folder before you can start working on any files in a Visual SourceSafe project.

3. Click the Drives arrow and click a drive. In the Folders box, double-click an existing folder.

If you want to create a new folder, type the new folder name in the Name box and click Create Folder.

4. Click OK.

Visual SourceSafe Explorer displays your working folder path above the file list.


NOTE: You must specify a working folder to perform any action that takes a file out of Visual SourceSafe, including the Check Out, Get Latest Version, and Merge commands. When you attempt to use any of these commands without a working folder, Visual SourceSafe displays a message asking if you would like to set a working folder. Click OK to set a working folder. Visual SourceSafe displays the Set Working Folder dialog box.

Basic Operations in Visual SourceSafe

As a developer on a project under source control, you will use the following four basic commands on a daily basis. They are available from the SourceSafe menu in the Visual SourceSafe Explorer window, as seen in Figure 26.16.

FIG. 26.16
Four basic operations in Visual SourceSafe are
Get Latest Version, Check Out, Check In, and Undo Check Out.

To get the most recent version of a file,

1. In Visual SourceSafe Explorer, select the file(s) in the file list.

2. Choose SourceSafe, Get Latest Version from the menu.

Visual SourceSafe copies the file(s) from the current project into your working folder for read-only access.

To check out a file,

1. In Visual SourceSafe Explorer, select the file(s) in the file list.

2. Choose SourceSafe, Check Out from the menu.

The Check Out command creates a writable copy of the file from the project in your working folder.


CAUTION: Never use the Get command to fetch files on which you plan to make changes. First of all, the files on your local computer will be read-only, so you will have to change their properties, and then you will not be able to check them back in when you are finished (because Visual SourceSafe doesn't know you were planning to change them--they are not checked out to you).

To check in one or more files to Visual SourceSafe project,

1. In Visual SourceSafe Explorer, select the file(s) in the file list.

2. Choose SourceSafe, Check In from the menu.

Visual SourceSafe displays the Check In dialog box, shown in Figure 26.17.

FIG. 26.17
The Check In dialog box is used to copy your changes into the Visual SourceSafe database and create a new version of the file.

3. Type a comment in the Comment box.

4. Other options.

If you want to continue working on the file(s) after you check in your changes, click Keep checked out. If you want to remove the copy of the file(s) in your working folder after the check-in is complete, click Remove Local Copy. By default, Visual SourceSafe leaves a read-only copy of the file in your working folder when you check in a file. If you want to see the differences between the version of the file you are checking in and the version you checked out, click Diff. This option is only for checking in a single file.

5. Click OK.


TIP: In any multiuser project, no file should be checked out for longer than it takes to make and test the changes to the file. If a file is kept checked out for several days by one programmer, other programmers might not receive the benefit of changes that have been made to it.

Sharing Codes Between Projects

Sharing is a feature that enables the user to access the same file from multiple projects. This is useful for users who have several different projects that share common components. Changes made to the component in one project will be reflected in all other projects sharing this component. This feature saves time and resources by avoiding duplication of effort and storage.

To share the current version of a file with another project using a drag-and-drop operation,

1. In Visual SourceSafe Explorer, click the project containing the file or files you want to share with another project.

2. Click the file or files you want to share.

3. Drag the file from its location in the file list to a different project in the project list.

Visual SourceSafe performs the share operation with no confirmation message. Visual SourceSafe does not allow you to share a file with a project that already contains that file.

Alternatively, you can use the Share command:

1. In Visual SourceSafe Explorer, click the project you want to share files into.

2. Choose SourceSafe, Share from the menu.

Visual SourceSafe displays the Share dialog box, shown in Figure 26.18.


NOTE: Inside the Visual SourceSafe database, there is only one copy, the master copy, of the shared file; each project to which the file belongs simply has a pointer to it. When you change the file in any one project, Visual SourceSafe immediately updates it in all the projects that share it.
3. In the Share dialog box project list, click the project containing the files you want to share.

FIG. 26.18
The Visual SourceSafe Share dialog box has options for sharing files.

4. Under File to Share, click the file(s) you want to share.

5. Click Share.

The file you share becomes part of the current project. All subsequent changes you make to the file are immediately part of the file in all projects that share it.


CAUTION: You cannot share files among multiple databases. For this reason, you should always organize your files into projects within a single database whenever possible.


NOTE: If a file is shared by multiple projects, destroying or purging it in one project does not delete the file from the Visual SourceSafe database, and therefore will not free any disk space.

You can share any file from any project with any other project to which you have access. When a file is shared by multiple projects, the icon for that file in the file list changes from a single file to overlapping files, as shown in Figure 26.19.

FIG. 26.19
The file icons representing unshared (top three) and shared (bottom three) files are different.


NOTE: You can use the command-line Links command to show a list of all projects that are sharing a file.

There is only one master copy of a shared file; thus, any changes actually checked in propagate to all of the projects that share the file. Branching is like a shared file but without the dynamic link. Changes made to the file in one project will not be reflected in other projects. This feature is used when you must have a snapshot of all the files in a project at a particular moment for testing purposes or to create customized or parallel versions of a project. Visual SourceSafe tracks branches by making each development path a different project. Different project names keep the branches distinct.

To share and branch a file using the Share command,

1. In Visual SourceSafe Explorer, click the project you want to share and branch the file into.

2. Choose SourceSafe, Share from the menu to display the Share dialog box as shown in Figure 26.20.

FIG. 26.20
Using the Share dialog box to share and branch a file for separate use in another project.

3. In the Share dialog box project list, click the project containing the file you want to share and branch.

4. Under File to Share, click the file you want to share and branch.

5. Click the Branch After Share checkbox.

6. Click Share.

Alternatively, you can use the file branching pop-up menu.

1. In Visual SourceSafe Explorer, right-click the file to be branched and drag it to the new project.

2. Release the mouse button and select Share and Branch from the pop-up menu.


NOTE: Don't add the same file separately to multiple projects. Instead, share the file among projects.

Sometimes, a fix made to a branched file needs to be updated with the original project. The Merge Branches command allows you to combine any changes between separated files. The merge always goes in one direction, from the project in which the file was changed into the project or projects in which you want the changes to appear.

To merge branched files,

1. In Visual SourceSafe Explorer, click the file into which you want to merge the changes.

2. Choose SourceSafe, Merge Branches from the menu.

Visual SourceSafe displays the Merge dialog box, shown in Figure 26.21.

FIG. 26.21
The Merge dialog box copies all the changes made in one branch of a file to another branch.

3. In the Merge dialog box, click the project containing the version of the file from which you want to merge the changes. You can then enter a comment when Visual SourceSafe prompts for one.

4. Click Merge.

After you complete the merge operation, changes merged into a file are immediately part of any project sharing the file.


NOTE: Only ASCII and ANSI text files can be merged. You must have the Check Out access right in the project being merged into, and the Read access right in the project being merged from, to use the Merge Branches command.

Version Tracking in Visual SourceSafe

In addition to various source control capabilities of Visual SourceSafe, version tracking capability is another primary benefit of using Visual SourceSafe in your software development process.

Visual SourceSafe tracks versions not only of files, but also of projects. Whenever developers check out files, make changes to them, and check them back into a Visual SourceSafe project, Visual SourceSafe tracks all the details of changes made on a file and project level. This history tracking feature enables developers to do a number of things:


NOTE: The number of versions of a given file that Visual SourceSafe can store is limited to 32,767.

Visual SourceSafe tracks versions of files and projects by showing version numbers, labels, and date/time. You can label a specific version of a project with a descriptive string as a way to freeze a moment in the development cycle. This way, you can easily find and work with a project that has been identified as significant in the development cycle.

To label a project,

1. In Visual SourceSafe Explorer, click a project.

2. Select File, Label from the menu.

Visual SourceSafe displays the Label dialog box, shown in Figure 26.22.

FIG. 26.22
The Label dialog box is used to assign a label to the specified version or current version of a file or project.

3. In the Label box, type a descriptive string of up to 31 characters.

4. Type a comment.

5. Click OK.


NOTE: It is not recommended to label a file. When you label a project with a string, all the files in that project are labeled with that string.

You can view the history of changes to any file or project by using the Show History command on the Tools menu. From the history dialog boxes, you can access a variety of other functions such as View, Get, and Share. You can also see details and print reports on the history of files and projects.

To show the file or project history,

1. Select the file (project) of which you want to see the history from the file (project) list.

2. Choose Tools, Show History from the menu in Visual SourceSafe, or click the right mouse button and select Show History from the pop-up menu.

Visual SourceSafe displays the History dialog box, shown in Figure 26.23.

FIG. 26.23
The History dialog box lists the versions starting with the most recent.

3. Click a command button in the History dialog box.

4. Click Close.

You can use the Show Differences command in Visual SourceSafe to compare the differences between two text files. You can compare two files on your computer; a file on your computer and a file stored in Visual SourceSafe; or versions of the same file both stored in Visual SourceSafe projects. The following procedure describes how to determine the differences between versions of the same file both stored in Visual SourceSafe projects.

To display differences between versions of the same file,

1. In Visual SourceSafe Explorer, select the file in the file list.

2. Choose Tools, Show History from the menu.

3. Select two versions in the History dialog box.

4. Click Diff.

Figure 26.24 shows file differences in Visual format, which is the default view. You can choose three different formats to view the differences: Visual, SourceSafe, or UNIX.

Visual SourceSafe displays the "Compare" file in the left pane of the display and the "To" file in the right pane of the display. Lines that differ between two versions are displayed in several contrasting colors. By default, for example, deleted lines are shown in blue, changed lines are shown in red, and inserted lines are displayed in green.

5. Click Close.


TIP: You can set the colors in the Difference tab of the SourcesSafe Options dialog box.

FIG. 26.24
The File Differences dialog box uses the Visual format as the default.

Using SourceSafe to Manage Web Content

Developing and managing a large-scale World Wide Web site involves a lot more than just writing HTML syntax. A large number of documents (for example, HTML files, script language files, and graphic format files), many developers, and lots of updates are normally involved in the process for submitting and updating web page content. Typical source control and version tracking features of Visual SourceSafe can help webmasters and web administrators manage the task just like any other software development project. Visual SourceSafe 5.0, however, introduces several new web features specifically designed to aid in managing web sites. These new web features include

This section outlines these new web features in Visual SourceSafe in addition to the standard benefits of using Visual SourceSafe for source control and version tracking in web site development projects.

Organizing a Web Site into a Project Tree

To use Visual SourceSafe as a web site management tool, you need to first organize your web site into a logical hierarchy of projects as in any other projects. Then you can create the projects and subprojects in Visual SourceSafe Explorer and add your web files to the project tree. By organizing the web site into a Visual SourceSafe project tree, you get the standard benefits that version control has to offer to software developers. That is, it helps manage and coordinate the team by keeping track of changes and file versions and archiving your files.

For example, G. A. Sullivan has two web site projects: $/ExternalWeb and $/GASnet. The former is for external purposes, and the latter is for internal purposes. The "internal web site" is available only to G. A. Sullivan employees. These two projects build completely different web sites hosted on completely different servers. Some of the files between the two web sites are different, but some are the same. When an HTML file is changed, this change might affect only one site, or it might affect both sites. It is important to copy the modified file to the right places. The sharing feature in Visual SourceSafe can help track and manage multiple webs automatically just like any other projects. If a file is used on both sites, it can be shared between both web projects. So whenever a change is made to this file in either project, that change is automatically reflected in both.

In addition to all the standard benefits of using Visual SourceSafe for source control and version tracking, some special benefits exist for web projects. The next several sections describe how to designate a project as a web project and how to use the three new web features in Visual SourceSafe.

Designating Web Projects

In order to use the new web features in Visual SourceSafe 5.0, the project first needs to be designated as a web site project. Your Visual SourceSafe administrator can do this by using the Visual SourceSafe Administrator program.

To designate a project as a web project,

1. Select Tools, Options from the menu in the Visual SourceSafe Administrator main window.

The Visual SourceSafe Administrator displays the SourceSafe Options dialog box.

2. Click the Web Projects tab on the SourceSafe Options dialog box.

The Web Projects tab displays, as shown in Figure 26.25.

FIG. 26.25
The Web Projects tab in the SourceSafe Options dialog box is used for designating a project as a web project.

This Web Projects tab contains the following five text input fields:

Once a project is designated as a web project and you restart the Visual SourceSafe program, Visual SourceSafe Explorer displays the designated project with a special icon to indicate that it is a web project. The web project icon has a small global image superimposed on it. Whenever a web project is selected, the commands on the Visual SourceSafe Web menu become enabled. Visual SourceSafe can then quickly check broken links among the project files, create a site map of the HTML files in the project and its subprojects, and automatically deploy the files to an Internet server location when they are ready. See Figure 26.26 for the Web menu in Visual SourceSafe.

FIG. 26.26
The commands on the Visual SourceSafe
Web menu are enabled whenever a web project is selected.


NOTE: You can also remove a web project designation by using the Web Projects tab in the SourceSafe Options dialog box. Simply clear the URL and Virtual Root fields and then click OK.

Checking Hyperlink Integrity

As a webmaster or web administrator, you want to make sure not to publish your web page content with broken links to a live web server. One of the new web features available in Visual SourceSafe--Check Hyperlinks--makes it easy to test for bad links before you publish your web page content to the server. You can choose to check the files in your working folder or those in the Visual SourceSafe project. Visual SourceSafe provides you with a report of any internal broken hyperlinks. You can access the Check Hyperlinks dialog box by choosing Web, Check Hyperlinks from the menu in Visual SourceSafe (see Figure 26.27). The broken links report is shown in Figure 26.28.

FIG. 26.27
In the Check Hyperlinks dialog box, you can request a report of any internal broken hyperlinks.

FIG. 26.28
The Check Hyperlinks command reports internal broken hyperlinks.

Visual SourceSafe differentiates between internal and external hyperlinks. Internal links are those within your web site in the same Visual SourceSafe project tree. Visual SourceSafe checks all local links among your HTML files and displays any potential problems. For example, the file frmain.htm in the project $/ExternalWeb/ refers to another file stlouis.htm, but this file does not exist in the same project. This hyperlink is, therefore, listed as invalid. External hyperlinks are jumps to sites on the World Wide Web that are not in your project tree. Visual SourceSafe does not check these external hyperlinks but only lists them in the bottom list of the Check Hyperlinks result window, as shown in Figure 26.28.

Creating a Site Map

Another new web feature available in Visual SourceSafe 5.0 is creating site maps. Site maps are often useful to the web users. They provide a list of hyperlinks to the web site's contents to help the users with the navigation. Visual SourceSafe can create a site map for your web site easily by generating a new HTML file and writing out a list of links to all the HTML files within your web site project. The name of this new site map HTML file was set by your Visual SourceSafe administrator, when the project was initially designated as a web project (refer to Figure 26.25 in the section "Designating Web Projects"). The Create Site Map dialog box displays when you choose Web, Site Map from the menu in Visual SourceSafe (see Figure 26.29).

FIG. 26.29
The Create Site Map dialog box enables you to create a site map.


TIP: Category names in the site map file are taken directly from your Visual SourceSafe project name, so you should use unique and descriptive strings as names for your web site projects. Once the HTML site map file is created, you can add it into your project by using the Add Files command. If you add the file to your web site project, be sure to check it out before running the Create Site Map command.

Testing and Deploying Web Content

Deploy is another new web feature in Visual SourceSafe 5.0. It can be used to send a web project to one or more test servers or live web servers that have been designated by the Visual SourceSafe administrator. Servers can reside on either local networks or on the Internet. If a server is outside the local network, it is reached by File Transfer Protocol (FTP). The deployment path was specified by your Visual SourceSafe administrator when the project was initially designated as a web project (refer to Figure 26.25 in the section "Designating Web Projects"). Because this command can potentially publish a web project to the entire World Wide Web, Visual SourceSafe requires you to have Destroy-level (D) access rights in the project in order to use it. Figure 26.30 shows the Deploy dialog box in Visual SourceSafe, which you can access by choosing Web, Deploy.

FIG. 26.30
The Deploy dialog box enables you to send a web project to a server.


NOTE: You can deploy any project that has been designated as a web project, regardless of the types of files it contains. That is, it does not necessarily have to be an actual web site. A single command then sends the entire project to the local or remote locations you have specified. You can only deploy an entire project, not specific files that are not designated as a project.

From Here...

Visual SourceSafe provides easy-to-use, project-oriented version control for managing software and web site development. In addition to basic source control and versioning capabilities, Visual SourceSafe provides advanced functionality that includes branching and merging to support customization and parallel development. Visual SourceSafe 5.0 also introduces some new web features for managing web site contents. Most features in Visual SourceSafe are easily executed through its graphical interface--Visual SourceSafe Explorer. The configuration and maintenance of Visual SourceSafe installation are also straightforward using its administrative program--Visual SourceSafe Administrator. Visual SourceSafe can definitely help the developers spend less time doing source code "bookkeeping" and more time coding. It fills a critical need in any team-based software and web site development environment.

The Visual Studio 97 suite is specifically designed for the team-oriented software development environment and contains many features supporting a team and its individual software developers. Refer to the following chapters for more information related to team development with Visual Studio 97:


Previous chapterNext chapterContents


© Copyright, Macmillan Computer Publishing. All rights reserved.