Share via


Associate a File Type with a Difference Tool

You can compare text and XML files by using the default comparison tool for Visual Studio. However, you can, for file types that you specify, enable the file-comparison tool that you prefer to use. You can use any comparison tool that supports, as command-line arguments, the full paths of the two files that you want to compare.

Required Permissions

To perform this procedure, you must be a member of the Administrators or Users security group on the computer where Visual Studio is installed. For more information, see Team Foundation Server Permissions.

To associate a file type with a third-party compare tool

  1. Perform either of the following sets of steps.

    1. In Visual Studio, open the Tools menu, and then click Options.

    2. In the Options dialog box, expand Source Control, click Visual Studio Team Foundation Server, and then click Configure User Tools.

    --or--

    1. In Windows, click Start, click All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio Command Prompt (2010).

    2. Type tf diff /configure.

  2. In the Configure User Tools dialog box, click Add.

    The Configure Tool dialog box opens.

  3. In the Extension box, specify the extension (for example, .cpp) that you want to associate with your tool.

  4. In the Operation list, click Compare.

  5. In the Command box, either type the path and name of your tool, or click the ellipses () to locate and specify it. The result should resemble the following example:

    C:\Program Files\OtherDiff\otherdiff.exe
    
  6. In the Arguments box, type any arguments that your tool requires:

    • %1: The path to the source file.

    • %2: The path to the target file.

    • %5: The options that the user specified by using the /option option of the Difference command. For more information, see Difference Command.

    • %6: Label ("friendly name") of the source file.

    • %7: Label ("friendly name") of the target file.

    Tip

    For information about frequently used external tools and the arguments that they require, see the following page on the Microsoft website: diff/merge configuration in Team Foundation - common Command and Argument values.

    Use white space to delimit the arguments.

    For example, you might specify the following syntax to compare two files:

    %1 %2
    

    Use quotation marks to pass white space or quotation marks to the tool.

    If an argument includes one or more spaces, you must enclose it in quotation marks (""). If an argument contains one or more quotation marks, you must add another quotation mark immediately after any quotation mark in the argument. For example, you could specify the following argument:

    "This "" embeds a double quote"
    

    Pass labels ("friendly names") to the tool.

    If your tool supports displaying a label (a "friendly name"), such as c:\workspace\test\MyWindow.xaml.cs;C5 (server) 4/26/2010 1:32 PM, you can include the %6 and %7 tokens to pass label values to the tool. If you do not specify these tokens, the tool may show names of temporary files, which can be difficult to read.

    For example, you might specify the following syntax to display labels.

    %1 /title1=%6 %2 /title2=%7
    

    Note

    This capability is not related to version-control labels, which you apply to specific versions of items in version control, as described in Use Labels to Take a Snapshot of Your Files.

  7. Click OK.

  8. If you want to specify more types of files, repeat steps 4−9.

  9. Click OK.

See Also

Other Resources

Comparing Folders and Files