Visual Studio works with another software tool called Visual SourceSafe (VSS). VSS controls access to source code, such as report definitions. This can prevent two report designers from trying to modify the same report at the same time. Even if you do not have multiple report designers, VSS can provide a consistent location where all your reporting projects can be found. VSS stores all the source code entrusted to its safekeeping in its own library database. If this VSS library database is located on a network, you have a central location where all the source code can be backed up regularly.
VSS has one more, very valuable feature. It keeps multiple versions of your source code. When you check in your source code, VSS does not write over the previous version. Instead, it keeps both the older version and the new version. You will continue to work with the newest version of the source code unless there is a problem and you ask to go back to an earlier version. This can really be a lifesaver when you make those massive formatting changes to a report and then you or your users decide that it was really better the way it was.
Visual SourceSafe is very tightly integrated with Visual Studio. Once VSS is installed and configured on your PC, you can probably do almost all your interaction with VSS through the Visual Studio menus. We will look at adding a reporting project to VSS control, checking reports into and out of VSS, and reverting back to an older version of a report.
Once VSS is set up on your PC, adding a reporting project to VSS control is very simple. Right-click the solution or the project in the Solution Explorer and select Add Solution to Source Control. You will be prompted to log in to VSS and to specify the VSS database you wish to use. Provide this login information and click OK. You will see the Add to SourceSafe Project dialog box displaying the project folder hierarchy in your VSS database. Modify the project name at the top of the dialog box if desired, then browse to the appropriate location in the project folder hierarchy and click OK.
Once the solution has been added to VSS control, a small lock icon will appear next to each entry in the Solution Explorer. This indicates that each file is checked into VSS. The local copy of each of these files is marked as read-only. It cannot be modified until it has been checked out.
To check out a report definition file, right-click the entry for that report in the Solution Explorer and select Check Out from the context menu. If you wish, you can enter a comment stating why the report is being checked out. The most recent version of the report will then be copied from the VSS database to your PC. It will no longer be read-only but rather will be ready to accept changes. The lock icon will be replaced by a small check mark in the Solution Explorer to indicate that the report is checked out. Only one person may have a report checked out at any given time.
Once you have completed your changes to the report definition, you need to check the report back into VSS. Right-click the entry for the report in the Solution Explorer and select Check In from the context menu. Again, you can enter a comment summarizing the changes you made. This is helpful if you ever have to revert back to an older version of a report.
If you want to get the latest version of a report that someone else is working on, without actually checking out the report, you can use the Get Latest Version feature of VSS. Right-click the entry for the report in the Solution Explorer and then select Get Latest Version from the context menu. A read-only copy of the latest version of the report will be copied to your PC.
Retrieving an earlier version of a report from VSS is very straightforward. Select the report in the Solution Explorer and then select File | Source Control | History. The History Options dialog box will appear. You can enter a range of dates to see the history of the report within that date range. You can also enter a user to see the versions checked in by that user. To see the entire history of the report, leave everything blank and click OK.
The History Of dialog box will appear. Here, you can scroll through the previous versions of the report. Click Get to retrieve a copy of a previous version. This previous version will then become your current copy of the report. Any previous versions of the report checked in after the version you just retrieved will continue to reside in the VSS database. Click Rollback to retrieve a copy of a previous version and get rid of any versions of the report that were checked in after the version you just retrieved.