In the previous post, I showed you how to use Visual Studio to compare 2 files. I also use Visual Studio Code from time to time. And, as every great IDE, Visual Studio Code also have a great diff tool. As with Visual Studio, you can use it to compare 2 versions of the same file if you use a source control. But you can also compare 2 files from your file system.
Comparing files using the User Interface
- Open the 2 files in Visual Studio Code
- Right click on one file and click "Select for compare"
- Right click on the other file and click "Compare file file1 with file2"
You should see the result:
Comparing files using the command line
- Using Visual Studio Code
"%ProgramFiles%\Microsoft VS Code\bin\code" --diff file1.cs file2.cs
- Using Visual Studio Code Insiders
"%ProgramFiles%\Microsoft VS Code Insiders\bin\code-insiders" --diff file1.cs file2.cs