New in Visual Studio: Compare Files with Solution Explorer

Dalia Abo Sheasha

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.



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

  • Rand Random 6
    • George Birbilis 2

      would be nice to be able to compare selected text with clipboard

    • Dalia Abo SheashaMicrosoft employee 2

      Thanks for the feedback! We’ll try to minimize duplication in the future.

    • ChM-TM 1

      Thanks to its shortness and its well done screen shots, this is the first blog post about this feature where my diagonal reading suffices to get me to use the feature.

    • Jérôme GARCIA 2

      Tuition is always a matter of repetition, and you have to inform newcomers.
      I just found out today how to use the compare feature!

    • Jorge Morales Vidal 3

      I think we do need multiple posts; repetition allows newcomers and people not following this blog very often to be aware of any new features Visual Studio has added. This helps with discoverability, so it’s welcome 🤗

  • Alain Henriot 1

    Alright. This is a useful and well-integrated feature.
    just a small translation shell of the French contextual menu: “Comparer la sélection” ou “Comparer les fichiers sélectionnés” and not “Comper sélectionné”.
    Thank you for your work.

  • dandy 3

    There’s one place that’s sorely missing a file comparison option, and that’s the dialog box that comes up after a VS crash, where it offers to recover from a set of backup files vs keep what’s in your local source…and you have no idea whether the content of the backup folder is the latest or not. So I always end up using an external tool to compare each file manually and (possibly) do some manual file management with Explorer…

    Please, fix this.

  • Nicolai Z-work 0

    Would be nice if I could compare files across projects in the solution…

    • Dalia Abo SheashaMicrosoft employee 0

      We plan on adding the ability to compare files across projects in the next release.

  • Heinrich Moser 1

    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 to compare it with the second file. Bonus points if the default directory of the file chooser is the directory that the current tab’s file is located in.

  • Marcus Möhrmann 0

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

  • Виталий 3

    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 0

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

  • Malcolm Windham 0

    What version did the “compare files” become available?

    • Dalia Abo SheashaMicrosoft employee 0

      Compare files became generally available in Visual Studio 17.7

Feedback usabilla icon