Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Visual Studio to use Beyond Compare

I would like to configure Visual Studio to open Beyond Compare by default as the diff tool. How can I do this?

like image 936
MrBoJangles Avatar asked Dec 16 '10 23:12

MrBoJangles


People also ask

How do I set Beyond Compare in Visual Studio?

Open Visual Studio. Select Options from the Tools menu. Select Source Control | Subversion User Tools. For the Diff and Merge entries, select Beyond Compare from the dropdown.

How do I change the diff tool in Visual Studio?

To integrate Code Compare into Team Foundation Server, open the Visual Studio options (Tools → Options). In the displayed dialog box, select the Source Control → Visual Studio Team Foundation Server node. Click the Configure User Tools button to set up diff and merge tools.


2 Answers

In Visual Studio, go to the Tools menu, select Options, expand Source Control, (In a TFS environment, click Visual Studio Team Foundation Server), and click on the Configure User Tools button.

image to show location of the Configure User Tools button

Click the Add button.

Enter/select the following options for Compare:

  • Extension: .*
  • Operation: Compare
  • Command: C:\Program Files\Beyond Compare 3\BComp.exe (replace with the proper path for your machine, including version number)
  • Arguments: %1 %2 /title1=%6 /title2=%7

If using Beyond Compare Professional (3-way Merge):

  • Extension: .*
  • Operation: Merge
  • Command: C:\Program Files\Beyond Compare 3\BComp.exe (replace with the proper path for your machine, including version number)
  • Arguments: %1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9

If using Beyond Compare v3/v4 Standard or Beyond Compare v2 (2-way Merge):

  • Extension: .*
  • Operation: Merge
  • Command: C:\Program Files\Beyond Compare 3\BComp.exe (replace with the proper path for your machine, including version number)
  • Arguments: %1 %2 /savetarget=%4 /title1=%6 /title2=%7

If you use tabs in Beyond Compare

If you run Beyond Compare in tabbed mode, it can get confused when you diff or merge more than one set of files at a time from Visual Studio. To fix this, you can add the argument /solo to the end of the arguments; this ensures each comparison opens in a new window, working around the issue with tabs.

like image 143
schellack Avatar answered Sep 22 '22 10:09

schellack


Visual Studio with Git for Windows

If you're using GIT as your source code management system instead of the (fairly dated) TFVC then Visual Studio doesn't have options to configure anything like this.
Instead it (rightly in my opinion) uses the GIT config file's setting. So if you already have GIT setup to use Beyond Compare or any other third party comparison software it will just pick this up and start using it.

If not then just set that up (see here for further and likely more up to date help). The relevant info for setting up Visual Studio with Beyond Compare 4 is:

  1. Open Visual Studio.
  2. Select Options from the Tools menu.
  3. Select Plug-In Settings under the Source Control branch of the left-side tree control.
  4. Select Microsoft Git Provider under Plug-In Settings on the right-hand pane.
  5. Edit the global git config file (location is OS specific for windows it's %HOMEDRIVE%%HOMEPATH%/.gitconfig. See here for info) OR if you want it to be repo specifict then after starting a project in a Git repository, edit the config file in the .git folder in the project folder.
  6. Change the config file to reflect the following changes:

    [diff]     tool = bc4 [difftool "bc4"]     cmd = \"C:\\Program Files (x86)\\Beyond Compare 4\\BComp.exe\" \"$LOCAL\" \"$REMOTE\" [merge]     tool = bc4 [mergetool "bc4"]     cmd = \"C:\\Program Files (x86)\\Beyond Compare 4\\BComp.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"  

If 64bit installer is used, verify the name of the executable. Mine was BCompare.exe

[diff]     tool = bc4 [difftool "bc4"]     cmd = \"C:\\Program Files\\Beyond Compare 4\\BCompare.exe\" \"$LOCAL\" \"$REMOTE\" [merge]     tool = bc4 [mergetool "bc4"]     cmd = \"C:\\Program Files\\Beyond Compare 4\\BCompare.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" 

Issues: If you create a new project and get VS to create the git repo at the same time it WILL add a load of overrides to the .git/config file forcing it to use Visual Studio again (Thanks for that MS!). SO either create the git repo via another means after the project has been setup (like via SourceTree or the command line etc...) OR edit the .git/config file (in the solution folder) and remove any overrides for the above settings.
Thanks to minnow in the comments for bringing my attention to it again.

Note: I keep coming across this but I am using VS with GIT and the answers aren't correct and although some of the comments mention a URL with the correct answer it's not clear and if I kept missing it I'm sure others will so hopefully this will solve that issue.

like image 43
GazB Avatar answered Sep 23 '22 10:09

GazB