Compare Files (3), With Visual Studio Extension Or Other Apps

One usually has the need to compare two files or two folders, or two branches, especially as a frequent user of Visual Studio, one hopes to find a way to use Visual Studio to complete the comparison job in Visual Studio with somewhat the way like Source Control or Version Control software for comparison.

This article will cover this topic and related issues (we use the current version of 2019 16.11.0).

It seems this article is a little bit too long, I split it into two: one with native Visual Studio Tool, another is Visual Studio with Extension or Non-Visual Studio.

After splitting the article into two, they are still too long, I split it as three,

Introduction

Contents of this article series,

  • Compare Files (1),  with TFS and Git GUI in Visual Studio
    • TFS
    • Git
  • Compare Files (2),  with Visual Studio Built-in Tool
    • Command-line in Visual Studio
    • Visual Studio Developer Command Prompt 
    • Windows Prompt
  • Compare Files (3),  with Visual Studio Extension or Non-Visual Studio Apps
    • A: Tools outside of Visual Studio for Files Comparison
      • Online comparison, such as diff
      • Other Applications, such as VS Code or Word
    • B: Visual Studio Extention for Comparison Tools from Third Parties:
      • Code Compare in Visual Studio --- devart.com
      • Compare Files VS2019 --- marketplace.visualstudio.com

The Visual Studio only supports the GUI Compare Files feature to TFS or Git, the source control tools.  We will discuss these features in the first article of this article series; and then as an alternative, we invoke the Visual Studio built-in Comparison Tools from the command line that we will discuss in the second article in this article series and finally, we discuss the alternative ways to compare files without Visual Studio in the third article.

C: Tools outside of Visual Studio for Files Comparison

 

1, Online Comparison

Google diff, you will get a bunch of online tools for comparison, such as Diffchecker - Online diff tool to compare text to find the difference,  

Copy and paste the contents of your two files for comparison into the two frames, then Find Differences, you will get.

These tools are easy to use, for occasional comparison, it is a good choice.

2, Other Applications, such as VS Code or MS Word

We skip MS Word because it is especially for office document comparison, not our code comparison.  VS Code actually is a good tool for comparison,

Open VS Code with the files you are going to compare. Right-Click one file you want to compare => Select for Compare.

Right Click another file you want to compare => Compare with Selected,

Then you get the comparison,

This is pretty good, one disadvantage is that the two compared files must be opened in the VS Code, but this can be easily reached by open a folder including your two compared files. Theoretically, you can open all files in one VS Code, and practically, you can do it, such as opening a VS Code instance from the C Drive root folder like this,

Then, the following VS Code instance will include all files in your computer, say, C Drive,

Other disadvantages of using VS Code are such like you cannot compare two folders, and it is not WITHIN Visual Studio, i.e., if we work with Visual Studio, for the comparison, we have to open another app, VS Code, to do the comparison.

D: Visual Studio Extention for Comparison Tools from Third Parties

As discussed in A&B of this article, Visual Studio has a built-in Compare Files Tool, which can be invoked in the condition, either from Command-Line or with GUI in the situations of using Version Control, such as TFS or Git.

However, the Command-Line method is not quite a user friendly without GUI support, while GUI support for Comparing Files in Visual Studio only works for invoking either TFS or Git version control, 

To overcome this disadvantage, there are quite some third party controls served as Visual Studio Extension for Files Comparison, such as Compare Files VS2019, some of them with the very fancy feature, such as Code Compare


Code Compare


Code Compare

We will not discuss this Visual Studio Extension in this article,

  1. We do need Comparing Files, but we are not using the tool concentrate for everyday work, I do not like to spend time learning too much beyond the Microsoft Product feature;
  2. For the same reason, the very fancy feature, say, from Code Compare, actually, is not necessary for my use.

Summary

In this article, we discussed the ways to compare two files without Visual Studio, such as online or by Visual Studio Code.  They are quite useful in some cases.

Reference


Similar Articles