Visual InterDev

Working Under Source Control

See Also

Once a Web application has source control enabled, you check your files in and out instead of getting and releasing working copies as you did before.

By checking files in and out through the Web projects in Microsoft® Visual InterDev™, team members have more control over when the master Web application and Visual SourceSafe repository are updated with newer versions from your local Web applications.

Note   If you use the Visual SourceSafe client instead of the Visual InterDev features to perform source control tasks, be sure to refresh your Web project in Visual InterDev before continuing with your work.

For more information about working under source control, see the following:

Adding Files to a Source Control-Enabled Web Application

Once you've enabled source control for a Web application, any files that you create or add to that Web application using Visual InterDev are added automatically to the Visual SourceSafe project. This includes files that are created in any Visual InterDev editor or files that you create in other applications and add to a Web project.

Note   If you add files directly to the project directory on the server, through the file system, those files will not be automatically added to the Visual SourceSafe project. To add those files to the Visual SourceSafe project, you need to refresh the project view by synchronizing the local Web application with the master Web application.

To synchronize the local and master Web applications

  1. In the Project Explorer, select the Web project.

  2. From the Project menu, select Web Project, and then choose Synchronize Files.

    Your view of the Project Explorer is refreshed and all files contained in the project directory appear in the Project Explorer.

    If you see an icon with a red "X," the associated file is not in the Visual SourceSafe project.

If you have a file in your Web project that for some reason is not under source control, you can add it manually.

To add a file manually to source control

  1. In Visual InterDev, select the file in the Project Explorer that you want to add to source control.

  2. From the Project menu, select Source Control, and then choose Add to Source Control.

To remove files from source control

  1. In Visual InterDev, select the file in the Project Explorer that you want to add to source control.

  2. From the Project menu, select Source Control, and then choose Remove from Source Control.

For more information about using Visual SourceSafe, see Troubleshooting Source Control.

Checking a File Out

You can check out a file directly in the Visual InterDev Project Explorer without running the Visual SourceSafe client. By default, when you check out a file, no one else can get a write-enable copy of the file. If you request a local copy of a file that another user has already checked out, Visual SourceSafe displays a message indicating that another user has the file checked out, and only allows you to get a read-only version of the file.

To check out a file

  1. In the Project Explorer, select the file you want to check out.

  2. From the Project menu, select Source Control, and then choose Check Out.

In the Project Explorer, files that are write-enabled in the local directory are shown in color, while read-only copies and files without any local copy appear in shades of gray.

File status in the Project Explorer

When a file is checked out, you get a write-enabled copy of the file and Visual SourceSafe marks the file as checked out in the Project Explorer. When you check in the local copy, the file is marked as checked in and all changes to the files are saved to the master Web server.

By default, you are prompted to choose between a write-enabled or a read-only copy of the file. If you know you always want one or the other, you can set Visual SourceSafe to always provide one or the other.

To specify how files are checked out

  1. From the Tools menu, choose Options.

  2. In the Options dialog box, choose Project and then Web Projects.

  3. From the When opening a file box, choose the source control option you want.

  4. Click OK.

Allowing Multiple Check Outs

If your team members want to be able to work on the same file simultaneously, your Visual SourceSafe administrator can allow more than one person to check out and edit a file by allowing multiple checkouts. This option allows more than one person to work on a file at the same time.

When multiple checkouts are allowed, each user who checks out the file gets a write-enabled copy of the file. If you are the second person to check the file in, you can review the differences and choose to merge the two versions. For more information, see the topic "Resolve Merge Conflicts with Visual Merge" in the Visual SourceSafe documentation.

To allow multiple checkouts

  1. On your master Web server, open the Visual SourceSafe Administrator.

  2. From the Tools menu, choose Options.

  3. On the General tab, choose Allow Multiple Checkouts.

  4. Click OK.

Getting the Master Version of a File

If you want to review the latest version of a file without making changes to the file, you can get a copy of the master version of a file without checking the file out. When you get the latest version of a file, a read-only copy of the master file is placed on your local Web server. For example, you might want to get the latest version of files that link to the files you are developing.

To get a copy of the master version of a file

Note   If the local directory is not synchronized with the master Web directory, this command may fail. If this happens, use the Refresh command on the View menu to synchronize the project with the Web directory, and then try the command again.

Checking Files In

When you check in a file, you replace the current version of the file in Visual SourceSafe with a revised version of the file from your local Web directory. Visual InterDev automatically interacts with Visual SourceSafe to check the file in; you don't have to perform any additional steps.

To check in a file

Note   The Check In command is different from the Save command. The Save command updates the file in the local or master Web applications, but does not update the source control version in Visual SourceSafe.

After the file is checked in, the version you originally checked out is placed in the Visual SourceSafe history for that file.

If you made changes to the file, but do not want to save them as the latest version in Visual SourceSafe, you can use the Discard Changes command to abandon all changes made since getting the local copy.

To discard changes made to a file