如何配置 Visual Studio 以使用 Beyond Compare

发布于 2024-10-08 00:49:51 字数 65 浏览 3 评论 0原文

我想将 Visual Studio 配置为默认打开 Beyond Compare 作为 diff 工具。我该怎么做?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

泼猴你往哪里跑 2024-10-15 00:49:51

在 Visual Studio 中,转到“工具”菜单,选择“选项”,展开“源代码管理”,(在 TFS 环境中,单击 Visual Studio Team Foundation Server ),然后单击“配置用户工具”按钮。

显示“配置用户工具”按钮位置的图像

单击添加按钮。

输入/选择以下比较选项:

  • 扩展名.*
  • 操作比较
  • 命令C:\Program Files\Beyond Compare 3\BComp.exe(替换为适合您计算机的正确路径,包括版本号)
  • 参数 em>: %1 %2 /title1=%6 /title2=%7

如果使用 Beyond Compare Professional(3 向合并):

  • 扩展: .*
  • 操作: 合并
  • 命令: C:\Program Files\Beyond Compare 3\ BComp.exe(替换为您计算机的正确路径,包括版本号)
  • 参数%1 %2 %3 %4 /title1=%6 /title2=% 7 /title3=%8 /title4=%9

如果使用 Beyond Compare v3/v4 标准版或 Beyond Compare v2(2 路合并):

  • 扩展.*
  • 操作合并
  • 命令C:\Program Files\Beyond Compare 3\BComp. exe(替换为适合您计算机的正确路径,包括版本号)
  • 参数%1 %2 /savetarget=%4 /title1=%6 /title2=%7

如果在 Beyond Compare 中使用选项卡

如果在选项卡模式下运行 Beyond Compare,当您从 Visual Studio 中一次比较或合并多于一组文件时,它可能会感到困惑。要解决此问题,您可以将参数 /solo 添加到参数末尾;这可确保每次比较都在新窗口中打开,通过选项卡解决问题。

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.

浅语花开 2024-10-15 00:49:51

Visual Studio with Git for Windows

如果您使用 GIT 作为 源代码管理系统而不是(相当过时的)TFVC 那么 Visual Studio 没有选项来配置类似的内容。
相反,它(我认为正确)使用GIT 配置文件的设置。因此,如果您已经设置了 GIT 来使用 Beyond Compare 或任何其他第三方比较软件,它就会选择它并开始使用它。

如果没有,则只需进行设置(请参阅此处了解更多信息和可能有更多最新的帮助)。使用 Beyond Compare 4 设置 Visual Studio 的相关信息是:

  1. 打开 Visual Studio。
  2. 从“工具”菜单中选择“选项”。
  3. 选择左侧树控件的源代码管理分支下的插件设置。
  4. 在右侧窗格的插件设置下选择 Microsoft Git Provider。
  5. 编辑全局 git 配置文件(位置是特定于 Windows 的操作系统的 %HOMEDRIVE%%HOMEPATH%/.gitconfig。请参阅 此处 获取信息)或者如果您希望它是特定于存储库的,那么在 Git 存储库中启动项目后,编辑配置文件项目文件夹中的 .git 文件夹。
  6. 更改配置文件以反映以下更改:

    <前><代码>[差异]
    工具=bc4
    [差异工具“bc4”]
    cmd = \"C:\\Program Files (x86)\\Beyond Compare 4\\BComp.exe\" \"$LOCAL\" \"$REMOTE\"
    [合并]
    工具=bc4
    [合并工具“bc4”]
    cmd = \"C:\\Program Files (x86)\\Beyond Compare 4\\BComp.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"

如果使用 64 位安装程序,请验证可执行文件的名称。矿
是 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\"

问题: 如果您创建一个新项目并让 VS 在以下位置创建 git 存储库
同时它.git/config文件添加大量覆盖
强制它再次使用 Visual Studio(感谢 MS!)。
因此,可以在项目设置后通过其他方式创建 git 存储库
(例如通过 SourceTree 或命令行等...)或编辑 .git/config 文件
(在解决方案文件夹中)并删除上述设置的所有覆盖。
感谢评论中的 minnow 让我再次关注它。

注意:我一直遇到这个问题,但我将 VS 与 GIT 一起使用,
答案不正确,尽管有些评论提到了网址
正确答案不清楚,如果我一直错过它,我就
当然其他人也会希望这能解决这个问题。

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.

夏日浅笑〃 2024-10-15 00:49:51

如果您使用的是 TFS,则可以在 Team Foundation 中的差异/合并配置 - 通用命令和参数值

它显示了如何配置以下工具:

  • WinDiff
  • DiffDoc(适用于 Word 文件)
  • WinMerge
  • 超越比较
  • KDiff3
  • Araxis
  • 比较它!
  • SourceGear DiffMerge
  • Beyond Compare 3
  • TortoiseMerge
  • Visual SlickEdit

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
将军与妓 2024-10-15 00:49:51

当新版本的 Visual Studio 发布、或者我移动 PC、或者新成员加入团队时,我厌倦了每 6 个月这样做一次。所以,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

可以在我的机器上运行。 YMMV。没有保证,没有退款。 VS似乎没有缓存密钥,因此立即生效。

} 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似乎没有缓存密钥,因此立即生效。

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

Works on my machine. YMMV. No warranties, no refunds. VS doesn't appear to cache the key, so takes effect immediately.

} 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.

黎歌 2024-10-15 00:49:51

在 Visual Studio 2008 + 中,转到

工具菜单 -->选择选项 

在此处输入图像描述

在选项窗口中 -->展开源代码控制 -->选择 Subversion 用户
工具-->选择超越比较

并单击“确定”按钮。

In Visual Studio 2008 + , go to the

Tools menu -->  select Options 

enter image description here

In Options Window --> expand Source Control --> Select Subversion User
Tools --> Select Beyond Compare

and click OK button..

小镇女孩 2024-10-15 00:49:51

@schellack 发布的答案对于大多数情况来说都是完美的,但我希望 Beyond Compare 能够模拟 Visual Studio 在其自己的合并窗口中使用的“与结果面板的 2 路合并”视图。

此配置隐藏了中间面板(据我所知,在大多数情况下未使用)。

 %1 %2 "" %4 /title1=%6 /title2=%7 /title3="" /title4=%9

感谢 Morgen< /a>

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

一笔一画续写前缘 2024-10-15 00:49:51

我正在使用 VS 2017 来处理在 Visualstudio.com 托管 (msdn) 上使用 Git 托管的项目。

上面的链接适用于我的“GITHUB FOR WINDOWS”说明。

http://www.scootersoftware.com/support.php?zz=kb_vcs# githubwindows

配置文件位于“c:\users\username\.gitconfig”所示的位置,我只是根据我的情况将 BC4 更改为 BC3,并使用了适当的路径:

C:/Program Files (x86) /超越比较3/bcomp.exe

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

雨后彩虹 2024-10-15 00:49:51

64 位 Windows 7 上的 VS2013 需要以下设置:
工具|选项|源代码控制| Jazz Source Control

检查复选框 使用外部比较工具...(很容易错过这一点)

2-Way Compare
可执行文件的位置:C:\Program Files (x86)\Beyond Compare 3\BCompare.exe

3-Way Conflict Compare
可执行文件的位置:C:\ Program Files(x86)\ Beyond Compare 3 \ BCompare.exe

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

望笑 2024-10-15 00:49:51

BComp.exe 也适用于多选项卡场景,因此无需添加 /solo,除非您确实需要单独的窗口来进行每个文件比较。在 Beyond Compare 3 和 4 上进行了测试/验证。道德:使用 BComp.exe,而不是 BCompare.exe,进行 VS 外部比较工具配置。

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.

最近可好 2024-10-15 00:49:51

我使用 BC3 进行 git diff,但我也会 vscode 添加到有用的 git diff 工具列表。有些用户更喜欢 vscode 而不是 vs ide 体验。

使用 VS Code 进行 Git Diff

git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"

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"
屋檐 2024-10-15 00:49:51

无法发表评论,因为我的声誉评分很低。

这是 Fresky 的 链接

Can't comment because my reputation score is low.

Here's a waybackmachine link to Fresky's link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文