August 21st, 2023
heart12 reactions

New in Visual Studio: Compare Files with Solution Explorer

Comparing code in different files is a common need for developers, yet it often disrupts the flow of your work. We’ve heard your feedback and are excited to introduce a new compare feature in Visual Studio. This feature enables you to compare code files directly within the Solution Explorer, eliminating the need for external tools and keeping you in your developer flow.

Effortless Code Comparison with Two Options

Recognizing that developers have different scenarios for comparing files, we’ve introduced two convenient ways to achieve the same goal: effortless code comparison to understand differences.

1. Compare Selected Context Menu

We’re introducing the “Compare Selected” context menu option, designed to simplify multi-file comparison. Hold down the Ctrl key and select two files in the Solution Explorer that you want to compare. After selecting the files, right-click and choose “Compare Selected” from the context menu. Visual Studio will instantly display a side-by-side comparison view, highlighting differences between the chosen files.

Visual Studio screenshot with two files selected and the "Compare Selected" selected. Then a screenshot of the compare of the two files.

2. Compare with… Context Menu

Our second option, the “Compare with…” context menu, provides a straightforward method to compare a file in your solution with an external file on your disk. Right-click on the file you wish to compare within the Solution Explorer, then select “Compare With…”. This action opens a File Explorer window, enabling you to navigate to any file on your disk and initiate the comparison process.

Let us know what you think!

We’re interested in learning about your experiences with the new compare feature and how it’s influencing your development workflow. If you have suggestions, comments, or insights, please don’t hesitate to share them with us at this link.

 

16 comments

Discussion is closed. Login to edit/delete existing comments.

Sort by :
  • Malcolm Windham

    What version did the “compare files” become available?

    • Dalia Abo SheashaMicrosoft employee Author

      Compare files became generally available in Visual Studio 17.7

  • Виталий · Edited

    1. Is it possible to integrate a feature that allows comparing two clipboard files, with one pasted into the left panel and the other into the right panel?
    2. Could you please implement command-line functionality for this ability?
    Compare two files: devenv.exe /diff /left:file1 /right:file2
    Compare blank (will paste from clipboard) and file: devenv.exe /diff /right:file2
    Compare two blanks: devenv.exe /diff
    I mean left panel also should be editable!

    • Heinrich Moser

      Re. 2: Command-line functionality for comparing two existing files already exists since (at least) VS 2015 (vsDiffMerge.exe), see, for example, https://stackoverflow.com/q/32948698/87698 for details.

  • Marcus Möhrmann

    I have the Comparer “Beyond Compare”, also used in Git, how to configure it?
    Marcus

  • Heinrich Moser · Edited

    We evaluated this feature, and we discovered that we seldom need to compare source code files contained in the Visual Studio solution, but that we often need to compare data files which are located outside the solution directory. Currently, there seems to be no way to do that with Visual Studio, since "Compare with..." is only available for files shown in Solution Explorer.

    Thus, our suggestion would be to add a "Compare with..." context menu entry to tabs. That way, we can drag and drop one of the data files into Visual Studio, and then use "Compare with..." on the tab...

    Read more