and Visual FoxPro
Visual Studio 98 offers greater possibilities for tight integration of Visual FoxPro projects with the other tools supplied in the Visual Studio package. In this session, we'll have an in-depth examination of the tight integration of Visual SourceSafe98 with Visual FoxPro.
Source code control can be a very useful tool to the solo developer as well as a key tool for multiple-developer teams. For the solo developer, source code control provides backup facilities and the ability to perform a "grand undo" as well as retrieve early builds or versions. With a multiple-developer team, source code control can ensure that all members of the team work with the latest revision of source code, protect the members of the team from inadvertently overwriting each others work, and provides a simple method to keep track of multiple releases of the software to the same or different clients.
Source code control programs have been around for quite some time but, like difficult backup programs, programs that prove too hard to use are too easy to avoid. With the increasing complexity of projects and the improved accessibility of these products, they are tools are worth the effort to learn. Integration of source code control directly into the development environment is a relatively recent feature that makes these programs easier to use.
Bear in mind that Visual SourceSafe, or any other source code control program, is its own product and you must learn its terminology and operations to get the greatest benefit from it. While many operations can easily be performed from within the FoxPro interface, you should become familiar with the less frequently needed maintenance functions that may only be available within the program itself.
CAUTION for VFP 5.0 users (and those who saw Ted's second benchmarking session at the 1997 DevCon session): Visual Studio 97 Service Pack 2 causes "Invalid Page Faults" in VFP if using integrated SourceSafe projects! Avoid Service Pack 2. You can find Service Pack 3 for Visual Studio 97 on the Microsoft Web site.
After installation, the developer who creates a project selects "Add Project to Source Control" if the Tools/Options are not set to do this automatically. All other developers can now access the project by selecting "Join Source Control Project…" from their File menu.
Each developer maintains their own copy of the shared project, and each has a complete copy of all of the source code. By default, all of the source code is flagged read-only to prevent inadvertent code changes. After checking out an individual file, additions and modifications to the source code are made by each developer on their local machine. When the changes have been tested and are ready to be shared with the rest of the development team, the developer chooses "Update Project List" from the Project/Source Control menu. This option updates a text version of the project, a .PJM file, with the changes this developer has made to their local project file. When other developers choose to update the shared project list, they will see the changes made by this developer.
Source Code Control works best on text files, as differing versions of text files can be visually compared. Since FoxPro keeps a lot of its designs in table format (SCX, VCX, MNX), these files cannot be compared directly. Instead, the integrated source control creates an ASCII version of each of these files (with corresponding SCA, VCA and MNA extensions) so that changes can be "diffed." The SCCTEXT.PRG program is used to create and interpret these ASCII files; this file can be modified to suit your needs.
Figure 1: Source Code Control using VFP's Project Manager enforces coordination between developers
Key items to remember during installation:
· Full install should be performed once to your network file server
· Each workstation must run NETSETUP.EXE to install client software on local machine
· Administrative setup: must change multiple checkouts option (see figure below)
· In VSS 5.0, you also need to add .PRG to file extensions for Visual FoxPro (second figure below)
· Each workstation needs to turn on Visual SourceSafe from Tools/Options:
· SourceSafe should be selected as active source control provider
· Change other options as your work style dictates
· Text generation program source is included; consider modifying to meet your needs
Figure 2: Administrator option for multiple checkouts must be turned on.
Figure 3: Fox VSS 5.0, you'll need to add the *.prg to VFP's File Types. VSS 6.0 fixes this.
Figure 4: Tools/Options/Project dialog provides SourceSafe options
Project Manager displays icons to show the status of each file:
Project file and all database and table files are not checked in. The project file is generated for each developer by the FoxPro-SourceSafe interface by reading the .PJM file, checked out by each developer who joins the project. The PJM file contains the "header" information for the project - name, address, icon, generator options, and a line for each file within the project.
Figure 5: Contents of a typical .PJM file
Once you have succeeded in using Visual SourceSafe with the Visual FoxPro Project Manager, there are a number of ways in which the collaboration between the two products can be enhanced:
Consider Automation as an Alternative
Rather than using the internal source code control mechanism, it is possible to control Visual Studio using Automation directly from FoxPro. You can scan the contents of a project (PJX files are just data tables) and process directly against the SourceSafe backend.
Documentation for SourceSafe 6.0 was expected to be available by the time the product ships. Documentation for version 5.0 is available on the Microsoft Web site at http://www.microsoft.com/ssafe An extract of the object model is included below:
VSSDatabase: A SourceSafe database.
VSSItem: A project or file. Note that there is also a VSSItems that is a collection for all the children in one project.
VSSVersion: One way of representing a specific version of a file or project. A VSSVersions is a collection of all the versions of a particular file or project.
VSSCheckout: A checkout record on a file. Note that once again there is a collection, since one file may have many simultaneous checkouts.
Here's a sample routine that lists the files available along the path specified:
* Program....: LISTTREE.PRG
* Version....: 1.0
* Author.....: Ted Roche
* Date.......: October 15, 1997
* Compiler...: Visual FoxPro 05.00.00.0412 for Windows