共用方式為


/Diff (devenv.exe)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Compares two files. The differences are displayed in a special Visual Studio window.

Syntax

devenv /Diff SourceFile TargetFile [SourceDisplayName [TargetDisplayName]]

Arguments

  • SourceFile

    Required. The full path and name of the first file to be compared.

  • TargetFile

    Required. The full path and name of the second file to be compared.

  • SourceDisplayName

    Optional. The display name of the first file.

  • TargetDisplayName

    Optional. The display name of the second file.

Remarks

If an instance of the IDE is already open, the file comparison appears in a tab in the current IDE.

Example

The first example compares two files without changing their display names. The second example compares the files while changing both of their display names. The third and fourth examples compare two files but apply an alias to only the first file or the second file.

devenv /diff File1.txt File2.txt

devenv /diff File1.txt File2.txt FirstAlias "Second Alias"

devenv /diff File1.txt File2.txt "File One"

devenv /diff File1.txt File2.txt "" FileTwo

See also