[Previous] [Next]
To implement source code control, first create a Visual SourceSafe database. Once you've created a Visual SourceSafe database, you can add a Visual Basic project to it. This is most easily done with Visual SourceSafe Administrator, shown in Figure 15-1. To start Visual SourceSafe Administrator, choose Programs from the Start menu, and then choose Microsoft Visual SourceSafe and Visual SourceSafe 6.0 Admin from the submenus.
Figure 15-1. Use Visual SourceSafe Administrator to configure source code control.
Visual SourceSafe is installed with a default source code database titled Common. When placing projects under source code control, it's best to start by creating your own source code database. When you do this, you'll begin to notice that Visual SourceSafe isn't always the most intuitive program. Most Windows applications let you create documents (including databases) by using items on a File menu. However, in Visual SourceSafe, you create databases by using the Tools menu. (Note that there isn't a File menu available in Visual SourceSafe Administrator.)
To create a Visual SourceSafe database, follow these steps:
Figure 15-2. Create each new Visual SourceSafe database in its own folder.
NOTE
You don't actually specify a name for the new Visual SourceSafe database; you specify the folder in which it is created.
In applications such as Microsoft Word or Microsoft Access, when you create a new document or database, the new object is automatically opened and ready to use. This is not how it works with Visual SourceSafe. After you create a Visual SourceSafe database, you must explicitly open the database. To open the database, choose Open SourceSafe Database from the Users menu. (Remember: sometimes you'll have to explore the menus to find the function you need.)
After choosing Open SourceSafe Database, you're shown the Open SourceSafe Database dialog box, as shown in Figure 15-3. At first, your new database won't appear in the list. Although Visual SourceSafe created the database for you, it doesn't remember it. You'll have to click the Browse button to locate and select the Visual SourceSafe database file you've created. (See Figure 15-4.)
Figure 15-3. Visual SourceSafe doesn't remember the database it just created, you must locate the database manually.
Figure 15-4. Visual SourceSafe saves its databases with the extension .ini, but not all .ini files are Visual SourceSafe databases.
NOTE
Although the extension .ini is commonly used for text files of a specific format throughout Windows, Visual SourceSafe actually uses the same extension for its databases! The interface and behavior of Visual SourceSafe deviates from accepted standards in many ways, and therefore it is not an exemplary model of standardization. However, if you can get past these shortcomings, you'll find a very useful tool that can help you deal with many administrative challenges.
Each new Visual SourceSafe database is created with an Admin and a Guest user. You'll need to create a custom user account for each developer who will access the project while it's under source code control. When a project under Visual SourceSafe protection is opened in Visual Basic, the person opening the project has to log in as a valid user. If you create passwords for the users, each user will have to enter a password as well. By making each user log in to the Visual SourceSafe database, you'll have a level of security, you'll be able to determine which files each and every user presently has checked out, and you'll be able to review version history for each user .
To add a new user to a Visual SourceSafe database, follow these steps:
Figure 15-5. Each user who will have access to the protected project must have a valid user account.
Figure 15-6. All users of a Visual SourceSafe database are shown in Visual SourceSafe Administrator, along with their rights and whether or not they are logged in to the database.
Although you can add users at any time, always start with at least one custom user. Also, even if you don't assign passwords to all the user accounts, consider adding a password to the Admin account to prevent other users from running Visual SourceSafe Administrator and modifying your configuration. To add a password to the Admin user, select the user in the list and choose Change Password from the Users menu.
To place a Visual Basic project under source code control, you must add the project and all of its files to the SourceSafe database. This can be a tedious and error-prone process if done manually. However, there is an easy way to add an entire Visual Basic project to source code control, and that's through Visual Basic itself.
To add a Visual Basic project to Visual SourceSafe, follow these steps:
Figure 15-7. Add an entire Visual Basic project to source code control by using the SourceSafe add-in menu.
Figure 15-8. To perform any functions with Visual SourceSafe, you must log in as a valid user.
Figure 15-9. Use this dialog box to name a project and to specify its location in the Visual SourceSafe database organizational tree.
Figure 15-10. Although you can selectively add files to source code control, it's best to add all of your Visual Basic source files.
After you select the files to place under source code control, Visual SourceSafe will display a dialog box as it adds the files to the current Visual SourceSafe database. If the project is very small, the dialog box might appear and disappear so fast that you won't notice it. When Visual SourceSafe is finished, the Visual Basic Project Explorer window refreshes, and you'll see new icons for each file in the project, as shown in Figure 15-11.
Figure 15-11. Files under source code control appear in the Project Explorer with icons indicating their Visual SourceSafe status, such as available, checked out by the current user, or checked out by another user.
The files under source code control appear with an icon of a document and a lock. When a file is checked out, a red check mark is placed on the icon's document.