I would like to configure Visual Studio to open Beyond Compare by default as the diff tool. How can I do this?
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.
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.
Configure User Tools
button? Visual Studio 2010 has none. –
Hornbeck C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
–
Aeriel code.exe --diff <file> <file>
and code.exe --merge <path1> <path2> <base> <result>
. –
Ragucci %1 %2 %3 %4
, file %4
seems to be missing in the file system. –
Ragucci 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:
- Open Visual Studio.
- Select Options from the Tools menu.
- Select Plug-In Settings under the Source Control branch of the left-side tree control.
- Select Microsoft Git Provider under Plug-In Settings on the right-hand pane.
- 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. 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.
.gitattributes
and .gitignore
. Can you replicate it with a new project and if so what kind of project is it? Would be interesting to see why we get different results. Oh also if you can replicate it what VS extensions do you have? Maybe they are the cause. :) –
Aggrandize \"C:\\Program Files\\Beyond Compare 4\\BComp.exe\"
–
Acrylyl .git/config
file to remove the relevant lines that are forcing it to use VS again. :) If this is the case (I will do some checks when I get some time) I will update the answer to help others. Thanks minnow –
Aggrandize .gitconfig
file and the .git/config
file in my solution folder to get VS to switch back to my external git diff editor. I also had to restart VS to get the changes to take. I think this part of your answer needs to be highlighted - it's so easy to miss in the rest of the answer. –
Turrell If you are using the TFS, you can find the more information in diff/merge configuration in Team Foundation - common Command and Argument values
It shows how to configure the following tools:
- WinDiff
- DiffDoc (for Word files)
- WinMerge
- Beyond Compare
- KDiff3
- Araxis
- Compare It!
- SourceGear DiffMerge
- Beyond Compare 3
- TortoiseMerge
- Visual SlickEdit
I got bored of doing this every 6 months when a new version of Visual Studio comes out, or I move PCs, or a new member joins the team. So, PowerShell:
# .Synopsys
# Sets up Beyond Compare professional as Diff tool for all instances of Visual Studio on this PC
# If you don't use TFS, change the sccProvider as appropriate
[CmdLetBinding()]
param(
$bcPath = 'C:\Program Files (x86)\Beyond Compare 3\BComp.exe',
$sccProvider = 'TeamFoundation'
)
$ErrorActionPreference = 'stop';
$baseKey = 'REGISTRY::\HKCU\Software\Microsoft\VisualStudio\*'
function SetRegKeyProperties($keyPath, [hashtable]$keyProps){
if(!(Test-Path $keyPath)){
Write-Verbose "Creating $keyPath"
# Force required here to recursively create registry path
[void] (new-item $keyPath -Type:Directory -Force);
}
foreach($prop in $keyProps.GetEnumerator()){
Set-ItemProperty -Path:$keyPath -Name:$prop.Key -Value:$prop.Value;
}
}
$configBases = dir $baseKey | ? { $_.PSChildName -match '^\d+\.\d$' }
foreach($item in $configBases){
Write-Host "Configuring $item"
$diffToolsKey = Join-Path $item.PSPath "$sccProvider\SourceControl\DiffTools"
SetRegKeyProperties (Join-path $diffToolsKey '.*\Compare') @{Command=$bcPath;Arguments='%1 %2 /title1=%6 /title2=%7'}
SetRegKeyProperties (Join-path $diffToolsKey '.*\Merge') @{Command=$bcPath;Arguments='%1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9'}
}
Works on my machine. YMMV. No warranties, no refunds. VS doesn't appear to cache the key, so takes effect immediately.
computer\hkey_local_machine\scooter software\beyond compare\exepath
. –
Moussorgsky In Visual Studio 2008 + , go to the
Tools menu --> select Options
In Options Window --> expand Source Control --> Select Subversion User Tools --> Select Beyond Compare
and click OK button..
I'm using VS 2017 with projects hosted with Git on visualstudio.com hosting (msdn)
The link above worked for me with the "GITHUB FOR WINDOWS" instructions.
http://www.scootersoftware.com/support.php?zz=kb_vcs#githubwindows
The config file was located where it indicated at "c:\users\username\.gitconfig" and I just changed the BC4's to BC3's for my situation and used the appropriate path:
C:/Program Files (x86)/Beyond Compare 3/bcomp.exe
The answer posted by @schellack is perfect for most scenarios, but I wanted Beyond Compare to simulate the '2 Way merge with a result panel' view that Visual Studio uses in its own merge window.
This config hides the middle panel (which is unused in most cases AFAIK).
%1 %2 "" %4 /title1=%6 /title2=%7 /title3="" /title4=%9
With thanks to Morgen
VS2013 on 64-bit Windows 7 requires these settings: Tools | Options | Source Control | Jazz Source Control
CHECK THE CHECKBOX Use an external compare tool ... (easy to miss this)
2-Way Compare Location of Executable: C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
3-Way Conflict Compare Location of Executable: C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
BComp.exe works in multiple-tabbed scenario as well, so there is no need to add /solo unless you really want separate windows for each file comparison. Tested/verified on Beyond Compare 3 and 4. Moral: use BComp.exe, not BCompare.exe, for VS external compare tool configuration.
I use BC3 for my git diff, but I'd also add vscode to the list of useful git diff tools. Some users prefer vscode over vs ide experience.
Using VS Code for Git Diff
git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"
Can't comment because my reputation score is low.
Here's a waybackmachine link to Fresky's link
© 2022 - 2024 — McMap. All rights reserved.