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

24,930

Solution 1

  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

Solution 2

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

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
24,930

Related videos on Youtube

Sombir Kumar
Author by

Sombir Kumar

With 10 years of experience, Innovative Technical Lead working on the role of Architect in BOLD with proven success in software project consultancy and solutions implementation. Adept at identifying and designing integration points for different types of systems Building software frameworks and core modules for various BOLD products Involved in software performance optimization, redesign and documentation Expertise in cloud based development, Microsoft Azure, Web API, ASP .NET MVC, SQL Server, ASP .NET, .NET core, Microservices Architecture, Event Driven Architecture and Domain Driven Design Currently, part of the core architecture group and proactively participate in Organizational Architectural discussions Implementing reliable, scalable, secure and cost effective reusable components/boilerplate Possesses strong knowledge and understanding in Data structures and Algorithms, Object oriented programming concepts, SOLID Principle and Design Patterns

Updated on June 03, 2021

Comments

  • Sombir Kumar
    Sombir Kumar almost 3 years

    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
    
  • Mladen B.
    Mladen B. over 7 years
    I like the "blackslashes" (black is back!) part :)
  • Jens Marchewka
    Jens Marchewka over 7 years
    I think remote and local are exchanged, aren't they?
  • BobbyVolley
    BobbyVolley almost 3 years
    I tested it and it works exactly as described. Thanks a lot!
  • Denys Pyshniuk
    Denys Pyshniuk over 2 years
    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.exe