我想配置Visual Studio打开超越比较默认作为差异工具。我该怎么做呢?
在Visual Studio中,转到工具菜单,选择选项,展开源控制,(在TFS环境中,单击Visual Studio Team Foundation Server),然后单击配置用户工具按钮。
单击添加按钮。
输入/选择以下比较选项:
.*
Compare
C:\Program Files\Beyond Compare 3\BComp.exe
%1 %2 /title1=%6 /title2=%7
如果使用Beyond Compare Professional (3-way Merge):
Merge
%1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9
如果使用Beyond Compare v3/v4 Standard或Beyond Compare v2 (2-way Merge):
%1 %2 /savetarget=%4 /title1=%6 /title2=%7
如果你在Beyond Compare中使用标签
如果您以选项卡模式运行Beyond Compare,当您一次从Visual Studio中区分或合并多个文件集时,它可能会混淆。为了解决这个问题,你可以将参数/solo添加到参数的末尾;这确保了每次比较都在一个新窗口中打开,解决了选项卡的问题。
/solo
如果你正在使用TFS,你可以在Team Foundation中的diff/merge配置-常用命令和参数值中找到更多信息
介绍如何配置以下工具:
在Visual Studio 2008 +中,转到
Tools menu --> select Options
在选项窗口中——> expand Source Control——>选择Subversion用户 >选择Beyond Compare . >
在选项窗口中——> expand Source Control——>选择Subversion用户 >选择Beyond Compare
单击“确定”按钮..
每隔6个月,每当Visual Studio的新版本出来,或者我移动电脑,或者有新成员加入团队时,我就会厌倦这样做。所以,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'} }
在我的机器上工作。YMMV。不保修,不退款。VS似乎没有缓存键,所以会立即生效。
VS2013在64位Windows 7上需要这些设置: 工具|选项|源码控制| Jazz源码控制
使用外部比较工具…(很容易忽略)
3-Way冲突比较 可执行文件位置:C:\Program Files (x86)\Beyond Compare 3\BCompare.exe
如果没有,那么就设置它(参见在这里以获得更多最新的帮助)。使用Beyond Compare 4设置Visual Studio的相关信息如下:
%HOMEDRIVE%%HOMEPATH%/.gitconfig
修改配置文件以反映以下变化:
[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\"
.git/config
注意:我一直遇到这个问题,但我使用VS与GIT和 答案是不正确的,尽管一些评论提到了一个URL 正确的答案是不清楚的,如果我一直错过它,我 当然其他人会这样做,所以希望这将解决这个问题
BComp.exe也可以在多选项卡场景下工作,所以没有必要添加/solo,除非你真的想为每个文件比较单独的窗口。在Beyond Compare 3和4上测试/验证。寓意:使用BComp.exe,而不是BCompare.exe,用于VS外部比较工具配置。
我使用VS 2017与Git托管的项目在visualstudio.com托管(msdn)
上面的链接为我工作与“GITHUB for WINDOWS”指令。
http://www.scootersoftware.com/support.php?zz=kb_vcs#githubwindows
配置文件位于“c:\users\username\”的位置。gitconfig”,我只是根据我的情况将BC4更改为BC3,并使用适当的路径:
C:/Program Files (x86)/Beyond Compare 3/bcomp.exe
@schellack发布的答案对于大多数情况都是完美的,但我想要Beyond Compare来模拟Visual Studio在自己的合并窗口中使用的“2路合并与结果面板”视图。
这个配置隐藏了中间面板(在大多数情况下AFAIK没有使用)。
%1 %2 "" %4 /title1=%6 /title2=%7 /title3="" /title4=%9
感谢摩根
我使用BC3作为我的git差异,但我也使用将vscode添加到有用的git差异工具列表中。有些用户更喜欢vscode而不是vs ide的体验。
git config --global diff.tool vscode git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"
不能评论,因为我的声誉评分很低。
这里有一个到Fresky的链接的倒车链接