Visual InterDev

Repairing Links

See Also

In large Web sites, it is essential that you can easily maintain the links in your Web applications. To facilitate this task, Microsoft® Visual InterDev™ offers the following assistance:

Preventing Broken Links

When you reorganize your Web application by deleting or moving files and folders, you might break links within the application. Visual InterDev provides a way to automatically repair links that would be broken by deleting or moving files and folders.

With link repair enabled for a project, all relative links in target files are repaired. Target files are the files that are being renamed, moved, or deleted. Referring files are files that contain links to target files. Links in referring files are repaired depending on the setting of the Link Repair option in the Web Project Options (Projects—Options Dialog Box) in the Options dialog box. Link repair for a project is enabled or disabled from the General Tab (Project Properties Dialog Box).

To control automatic link repair

  1. On the Tools menu, choose Options.

  2. In the Options dialog box, select Projects, and then select Web Projects in the navigation pane.

  3. In the Link repair area, choose a link repair option.
    To Select
    Always update links automatically on both the master Web server and the local Web server Repair links in referring files
    Never update links automatically Don’t repair links in referring files
    Get a prompt and decide each time Ask me each time

Warning   When you work with files under source control, you should check all of your Web application files in before renaming or moving files. If a file is checked out exclusively by another user, the links within the file may not be updated properly.

You should also periodically update the link information on your local Web server and the master Web server to provide the most current information for link diagrams and the Broken Links Report.

Updating Link Information

If you work in a multiple developer environment, chances are high that the changes you or others make to the master Web server will change the link information for the Web application. To keep your link information current, you should periodically refresh the link information on both your local Web server and the master Web server.

You can refresh your link information by using the Recalculate Links command. In master mode and local mode, the Recalculate Links command first updates the link information on the master Web server and then updates the link information on the local Web server. When working offline, Recalculate Links updates only the link information on the local Web server.

Note   Recalculating links can take several minutes, depending on the size of the Web application. While Visual InterDev recalculates links, you will be unable to work on other files in Visual InterDev.

To recalculate links explicitly

  1. In the Project Explorer, select the root of the project.

  2. From the Project menu, choose Web Project, and then choose Recalculate Links.

    Visual InterDev examines all of the files in the Web application and updates the link information. If you are using source control, Visual InterDev refreshes the Master Web with the latest versions of files from the source control database. If your project includes a Search Bot, as is found in the Search.htm file generated by the Web Project Wizard, your Web project's meta information cache is also updated.

Recalculating links for a Web project provides the most current link information for link diagrams and the Broken Links Report.

Finding Broken Links and Unreferenced Files

In a large Web site, you need an easy way to find all of the broken links in your files. Visual InterDev provides two methods for identifying broken links: link diagrams and the Broken Links Report.

A link diagram allows you to visually verify links for individual files or sets of files. For more information about visualizing broken links, see Viewing Links for an Item.

The Broken Links Report allows you to identify broken links and unreferenced files for an entire Web project. Unreferenced files are files in your Web project that do not have any in links. These files may be necessary for creating and maintaining your Web project but do not need to be deployed to the production server. For example, site diagram files (*.wdm) contain essential navigation structure information but are not needed on the production Web server.

Note   You can specify which file types are not deployed in the Web Project Options (Projects—Options Dialog Box) in the Enterprise Edition of Microsoft® Visual Studio™ and Visual InterDev.

Unreferenced files may also be files that contain links that the Broken Links Report does not recognize or files that are no longer used and should be deleted. For a list of HTML tags recognized as links, see HTML Tags and Link Diagrams.

Note   Creating a Broken Link Report can take several minutes, depending on the size of the Web application. While Visual InterDev verifies links, you will be unable to work on other files in Visual InterDev.

To identify broken links and unreferenced files

  1. In the Project Explorer, choose the root of the project.

  2. From the View menu, choose Broken Links Report.

    The Links Report message appears, indicating that the links for the Web application are being checked.

When the Broken Links Report is complete, the files with broken links and unreferenced files are listed in the Task List Window and the Output Window.

From the Task List window, you can double-click any file listed to open the file in the default editor.