Compare two files in Visual Studio

2019-01-07 01:16发布

I saw new comparsion tool in VS 2012 for comparing two files or two versions of file. I like it. But when I tried to find it I can't because I don't use TFS. Is there a way how can I just compare two files with builtin feature in VS but without TFS?

16条回答
淡お忘
2楼-- · 2019-01-07 01:53

You can invoke devenv.exe /diff list1.txt list2.txt from the command prompt or, if a Visual Studio instance is already running, you can type Tools.DiffFiles in the Command window, with a handy file name completion:

Using Tools.DiffFiles from Visual Studio Command window

查看更多
Emotional °昔
3楼-- · 2019-01-07 01:53

There is also a Visual Studio extension called CompareFiles, which does nothing else but adding the "Compare Files" entry to the solution explorer context menu. It invokes the built-in Visual Studio diff tool.

Just in case that someone (like me) doesn't want to install an all-in-one extension like VSCommands...

查看更多
男人必须洒脱
4楼-- · 2019-01-07 01:53

In Visual Studio 2012, 2013, 2015, you can also do it with Web Essentials, just right click the files and from context menu > Web Essential >> Diff selected files:

Edit: It's now available as a separate extension

enter image description here

查看更多
小情绪 Triste *
5楼-- · 2019-01-07 01:55

If you are working with TFS connected then right click on file which you need to compare (through source control explorer) and it presents you a window like this - enter image description here

Now change path of source file in 'Souce Path:' and you get comparision through VS comparision tool.

Similarly you can compare folder also which compares all files of a folder at once.

查看更多
Juvenile、少年°
6楼-- · 2019-01-07 01:58

You can try VSCommands extension from Visual Studio Gallery. Latest release allows you to select two file and compare them:

enter image description here enter image description here

查看更多
小情绪 Triste *
7楼-- · 2019-01-07 02:00

File Comparer VS Extension by Akhil Mittal. Excellent lightweight tool that gets the job done.

查看更多
登录 后发表回答