The Necessity of Consistent Interface Design

Setting Up Visual SourceSafe

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 18-1. To start Visual SourceSafe Administrator, choose All Programs from the Start menu and then choose Microsoft Visual SourceSafe and Visual SourceSafe 6.0 Admin from the submenus.

Note

Visual SourceSafe isn't typically installed with Visual Basic .NET; you might have to install it separately before using it.


 

Figure 18-1. Use Visual SourceSafe Administrator to configure source code control.

graphics/f18ln01.jpg

Creating a Visual SourceSafe Database

Visual SourceSafe is installed with a default source code database named 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:

  1. Choose Create Database from the Tools menu.

  2. Enter the name of the folder in which you want to create the source code database. (See Figure 18-2.) This folder should be a new, empty folder placed on the network where all developers can access it. Make sure that all developers who'll use the project have full access to this folder and its subfolders.

  3. Click OK to commit your folder selection.

    Figure 18-2. Create each new Visual SourceSafe database in its own folder.

    graphics/f18ln02.jpg

    Warning

    Each project file contains a Globally Unique Identifier (GUID) that uniquely identifies that project within a solution. If you attempt to copy and rename an existing project file to create a new project, both the original and the copy will share the same GUID and cannot be distinguished from one another by Visual Studio .NET. In this case, you will experience problems if you include both projects in the same solution.


     

Opening a Visual SourceSafe Database

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 18-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 18-4.)

Figure 18-3. Visual SourceSafe doesn't remember the database it just created; you must locate the database manually.

graphics/f18ln03.jpg

Figure 18-4. Visual SourceSafe saves its databases with the extension .ini, but not all .ini files are Visual SourceSafe databases.

graphics/f18ln04.jpg

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; therefore, it's 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.


 

Adding Users to a Visual SourceSafe Database

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:

  1. Choose Add User from the Users menu to display the Add User dialog box, shown in Figure 18-5.

  2. Enter the name of a user and the user's password. Leave the password field blank if you don't want to enforce passwords.

  3. To grant the user read-only access to files under source code control, select the Read Only check box. Don't select this check box if you want the user to be able to modify files.

  4. Click OK to save the new user's information. The new user then appears in the main Visual SourceSafe Administrator window. (See Figure 18-6.)

    Figure 18-5. Each user who will have access to the protected project must have a valid user account.

    graphics/f18ln05.jpg

    Figure 18-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.

    graphics/f18ln06.jpg

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.

Placing a Visual Basic Project Under Visual SourceSafe Control

To place a Visual Basic project under source code control, you must add the project and all of its files to the Visual 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 .NET itself.

To add a Visual Basic project to Visual SourceSafe, follow these steps:

  1. Start Visual Basic .NET, and open the project you want to add to Visual SourceSafe.

  2. Visual Basic .NET is integrated with Visual SourceSafe by way of the Source Control submenu on the File menu. (See Figure 18-7.) Choose Add Selected Projects To Source Control from the SourceSafe submenu.

    Figure 18-7. Add an entire Visual Basic project to source code control by using the Source Control submenu.

    graphics/f18ln07.jpg

  3. After choosing to add the Visual Basic project to source code control, you're asked to log in to the Visual SourceSafe database, as shown in Figure 18-8. Enter your user name and password (if applicable), and make sure that the proper Visual SourceSafe database is specified in the Database text box. If the database displayed isn't correct, click Browse to locate and select the proper database.

  4. Click OK to log in to Visual SourceSafe and add the project to source code control.

    Figure 18-8. You must log in as a valid user to perform functions using Visual SourceSafe.

    graphics/f18ln08.jpg

  5. After you log in to Visual SourceSafe, you're shown the Add To SourceSafe Project dialog box, as shown in Figure 18-9, which displays the current project tree of the active Visual SourceSafe database. If projects already exist in the active Visual SourceSafe database, they'll appear in this dialog box. (You can have more than one project in a Visual SourceSafe database.) Use this dialog box to specify the name of the project as well as its location in the database organizational tree. Usually, accepting the defaults is adequate.

    Figure 18-9. Use this dialog box to name a project and to specify its location in the Visual SourceSafe database organizational tree.

    graphics/f18ln09.jpg

After you specify the name and location and click OK, Visual SourceSafe will display a dialog box as it adds the files to the 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 Solution Explorer window refreshes, and you'll see new icons for each file in the project, as shown in Figure 18-10.

Figure 18-10. Files under source code control appear in the Solution Explorer window with icons indicating their Visual SourceSafe status, such as available, checked out by the current user, or checked out by another user.

graphics/f18ln10.jpg

The files under source code control appear with an icon of a lock. When a file is checked out, a check mark is shown in place of the lock.



Practical Standards for Microsoft Visual Basic. NET
Practical Standards for Microsoft Visual Basic .NET (Pro-Developer)
ISBN: 0735613567
EAN: 2147483647
Year: 2005
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net