How to use Visual Studio (vsdiffmerge) as external diff tool in SourceTree for Mercurial?
K

7

26

I am using Mercurial for my source control and SourceTree to manage it. I want to use Visual Studio's built in diff and merge tool (vsdiffmerge) for comparing files however this is not working.

I am currently using the following:

Diff Commands:

\"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe\"

Diff Arguments:

\"$LOCAL\" \"$REMOTE\" //t

Merge Commands:

\"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe\"

Merge Arguments:

\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m

enter image description here

The Visual Studio diff tool is not getting launched. Could you please take a look?

Update:-

   We should use like below:-
   Diff Command: 
   full path of vsDiffMerge.exe
   For VS 2015 and below you can find it in the Visual Studio installation folder, under Common7\IDE subfolder. Visual Studio 2017 has it slightly more hidden. Look under Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer.


   Diff Argument: "$LOCAL" "$REMOTE" "Source" "Target" //t
   Merge Argument: $LOCAL" "$REMOTE" "$BASE" "$MERGED" //m
Kingship answered 5/10, 2015 at 12:31 Comment(0)
M
7
  1. You have a lot of useless (at least) blackslashes in commands and arguments
  2. Read Setting Up DiffMerge page, second chapter and fix own mistakes
Mall answered 6/10, 2015 at 19:24 Comment(1)
I like the "blackslashes" (black is back!) part :)Basilio
S
18

For Visual Studio 2019 Enterprise vsDiffMerge.exe location is:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe

Scotticism answered 31/5, 2019 at 17:51 Comment(1)
Meanwhile, the update for Visual Studio 2022 Community vsDiffMerge.exe location is: C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exeLavoie
F
8

For Visual Studio 2015

Put this line in the Diff Command box:

C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/vsDiffMerge.exe

And this one in the Arguments box:

$REMOTE $LOCAL $BASE $MERGED //m
Filmdom answered 1/7, 2016 at 10:19 Comment(1)
I think remote and local are exchanged, aren't they?Limicolous
M
7
  1. You have a lot of useless (at least) blackslashes in commands and arguments
  2. Read Setting Up DiffMerge page, second chapter and fix own mistakes
Mall answered 6/10, 2015 at 19:24 Comment(1)
I like the "blackslashes" (black is back!) part :)Basilio
C
6

With Visual Studio 2015 Update 1 and SourceTree 1.7.0.32509 this is only setting, which works for me:

C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/vsDiffMerge.exe 
$REMOTE $LOCAL $BASE $MERGED //m
Carswell answered 27/1, 2016 at 9:46 Comment(0)
B
3

Here's the full answer for VS 2019 diff and merge, works with Git and Mercurial.

Diff:

Diff Command: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe

Arguments: $LOCAL $REMOTE //t

Merge:

Merge Command: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe

Arguments: $REMOTE $LOCAL $BASE $MERGED //m

If you have the Enterprise VS edition, change the paths to this: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe

Image of diff/merge section of SoureTree with correct settings.

Brindle answered 2/6, 2021 at 17:57 Comment(1)
I tested it and it works exactly as described. Thanks a lot!Fibre
A
2

worked for VS 2022

Diff Command:

C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsDiffMerge.exe

Arguments:

$LOCAL $REMOTE //t

Merge Command: same

Arguments:

$REMOTE $LOCAL $BASE $MERGED //m

enter image description here

Arevalo answered 20/6, 2022 at 20:7 Comment(0)
H
0

Follow this SO for more guidance What are the command line arguments for TFS default merge tool for VS 2012?

Also these pointers http://roadtoalm.com/2013/10/22/use-visual-studio-as-your-diff-and-merging-tool-for-local-files/

Truth is, I tried setting it up as well and didn't have much luck. I happen to use Beyond Compare. If you want it to work, at least stay within the choices that SourceTree offers in the drop-down list of external diff options. No good reason to use anything else they aren't supporting.

Hydrostat answered 6/10, 2015 at 14:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.