如何配置 Visual Studio 以使用 Beyond Compare
我想将 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
在 Visual Studio 中,转到“工具”菜单,选择“选项”,展开“源代码管理”,(在 TFS 环境中,单击 Visual Studio Team Foundation Server ),然后单击“配置用户工具”按钮。
单击添加按钮。
输入/选择以下比较选项:
.*
比较
C:\Program Files\Beyond Compare 3\BComp.exe
(替换为适合您计算机的正确路径,包括版本号)%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.
Click the Add button.
Enter/select the following options for Compare:
.*
Compare
C:\Program Files\Beyond Compare 3\BComp.exe
(replace with the proper path for your machine, including version number)%1 %2 /title1=%6 /title2=%7
If using Beyond Compare Professional (3-way Merge):
.*
Merge
C:\Program Files\Beyond Compare 3\BComp.exe
(replace with the proper path for your machine, including version number)%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):
.*
Merge
C:\Program Files\Beyond Compare 3\BComp.exe
(replace with the proper path for your machine, including version number)%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.Visual Studio with Git for Windows
如果您使用 GIT 作为 源代码管理系统而不是(相当过时的)TFVC 那么 Visual Studio 没有选项来配置类似的内容。
相反,它(我认为正确)使用GIT 配置文件的设置。因此,如果您已经设置了 GIT 来使用 Beyond Compare 或任何其他第三方比较软件,它就会选择它并开始使用它。
如果没有,则只需进行设置(请参阅此处了解更多信息和可能有更多最新的帮助)。使用 Beyond Compare 4 设置 Visual Studio 的相关信息是:
%HOMEDRIVE%%HOMEPATH%/.gitconfig
。请参阅 此处 获取信息)或者如果您希望它是特定于存储库的,那么在 Git 存储库中启动项目后,编辑配置文件项目文件夹中的 .git 文件夹。更改配置文件以反映以下更改:
<前><代码>[差异]
工具=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\"
问题: 如果您创建一个新项目并让 VS 在以下位置创建 git 存储库
同时它将向
.git/config
文件添加大量覆盖强制它再次使用 Visual Studio(感谢 MS!)。
因此,可以在项目设置后通过其他方式创建 git 存储库
(例如通过 SourceTree 或命令行等...)或编辑 .git/config 文件
(在解决方案文件夹中)并删除上述设置的所有覆盖。
感谢评论中的 minnow 让我再次关注它。
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:
%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:
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
fileforcing 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.
如果您使用的是 TFS,则可以在 Team Foundation 中的差异/合并配置 - 通用命令和参数值
它显示了如何配置以下工具:
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:
当新版本的 Visual Studio 发布、或者我移动 PC、或者新成员加入团队时,我厌倦了每 6 个月这样做一次。所以,PowerShell:
可以在我的机器上运行。 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:
Works on my machine. YMMV. No warranties, no refunds. VS doesn't appear to cache the key, so takes effect immediately.
在 Visual Studio 2008 + 中,转到
并单击“确定”按钮。
In Visual Studio 2008 + , go to the
and click OK button..
@schellack 发布的答案对于大多数情况来说都是完美的,但我希望 Beyond Compare 能够模拟 Visual Studio 在其自己的合并窗口中使用的“与结果面板的 2 路合并”视图。
此配置隐藏了中间面板(据我所知,在大多数情况下未使用)。
感谢 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).
With thanks to Morgen
我正在使用 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
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
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.
我使用 BC3 进行 git diff,但我也会 将 vscode 添加到有用的 git diff 工具列表。有些用户更喜欢 vscode 而不是 vs ide 体验。
使用 VS Code 进行 Git Diff
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
无法发表评论,因为我的声誉评分很低。
这是 Fresky 的 链接
Can't comment because my reputation score is low.
Here's a waybackmachine link to Fresky's link