How can I use the diff tool of Visual Studio 2012 in Sourcetree?

I would like to use the diff tool of visual studio 2012 with Sourcetree. Is there a way to do that?

4 answers

1 accepted

4 votes
Accepted answer

Ok, now I have it:

  1. Tools > Options > Diff
  2. Change 'External Diff Tool' to 'Custom'
  3. Set 'Diff Command' to 'path\to\devenv' (e.g. C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe)
  4. Set 'Arguments' to '-Diff $LOCAL $REMOTE' (works with '-' or '/' on command line, SourceTree needs '-')
  5. Click OK
  6. restart SourceTree

(Now it would be great if it would use an existing visual studio window and won't open a new one)

You should be able to use it like so:

  1. Tools > Options > Diff
  2. Change 'External Diff Tool' to 'Custom'
  3. Set 'Diff Command' to 'path\to\devenv'
  4. Set 'Arguments' to '$LOCAL $REMOTE'
  5. Click OK

However unfortunately there's a bug with using 'Custom' setup right now, I've fixed this but only for 0.9.1.2+. We're having some issues with out CDN which are delaying getting this update out, but once this is resolved you should be able to get 0.9.1.2 and use this option.

Ok, now I have version 0.9.1.2 - but It doesn't work...

If I open a command promt and use this command I get a diff window:

>"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe" /Diff C:\Users\Stefan\AppData\Local\Temp\aiT4ea_WaveGraphRenderer.vb c:\Users\Stefan\Documents\WaveGraphRenderer.vb

But if I set the arguments in SourceTree to '/Diff $LOCAL $REMOTE' visual studio opens, the two files are opened in the IDE, but the diff window is not shown and I get the following error:

---------------------------
Microsoft Visual Studio
---------------------------
The following files were specified on the command line:

    C:/Program Files (x86)/Git/Diff

These files could not be found and will not be loaded.
---------------------------
OK  
---------------------------

Any idea?


Ciao!
Stefan

P.S.: SourceTree has to be restartet after every change in the options menu.

Above solutions do not work correctly. The only solution I have found which truly works, is this:

 

https://github.com/Inmeta/Knowledge/wiki/Setting-Up-DiffMerge

Thanks Stefan, this works great for diffs. But how can I use this for merges? Is there a switch for devenv.exe for merge or should I use the vsdiffmerge.exe with these args: 

$REMOTE $LOCAL $BASE $MERGED //m

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Featured Groups

Want to know how Atlassians monitor their enterprise deployments?

At Atlassian, we believe in our own products – that's why we use them, even at the enterprise level. Doing so gives us first-hand experience of how they perform at scale; to do this, we monitor each ...

74 views 2 7
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you