visual-studio-2010 - 我可以在 Visual Studio 中使用 WinMerge 作为我的合并/差异工具吗?

标签 visual-studio-2010 tfvc winmerge difftool

我需要比较我的项目中的两个文件,它是用 C# 编写的。我可以将 WinMerge(或任何其他差异工具)与 Visual Studio 集成并在内部轻松使用它吗?

最佳答案

paulbouwer.com life and technology上有更详细的解答
Replace diff/merge tool in Visual Studio Team System with WinMerge文章,还有你需要传递的参数。

我将完整复制它,因为我无法比他更好地解释它:

Replace diff/merge tool in Visual Studio Team System with WinMerge

JANUARY 31, 2010

I have been using Visual Studio Team System 2008 for a while now and am really starting to like the tightly integrated source control and work item functionality. One thing I cannot get used to is the basic diff/merge tool.

Where is the detail ?

The screenshot below demonstrates the basic nature of the diff tool built into Visual Studio Team System. There is no indication of the number of differences between the files being diff’ed or even the actual differences on a particular line … Visual Studio Team System Default Diff Tool

WinMerge

There is an alternative and it is both open source and free ! From the WinMerge site:

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.



下载 WinMerge 并安装它。

配置 Visual Studio

开通 源代码管理 > Visual Studio Team Foundation 工具 > 选项 Visual Studio 中的菜单。

Tools > Options > Source Control > Visual Studio Team Foundation

点击 配置用户工具... 和“配置用户工具”对话框
将可用。

Configure User Tools ...

添加比较工具的 WinMerge 详细信息。点击 添加... 上的按钮配置用户工具 对话框并按照下面的屏幕截图进行配置。参数文本框旁边的箭头按钮显示有关 Visual Studio 可以为正在配置的工具提供的信息的详细信息。

下面配置的参数是:/e /u /wl /wr /dl %6 /dr %7 %1 %2
Configure Tool for Compare Operation

添加合并工具的 WinMerge 详细信息。点击 添加... 上的按钮配置用户工具 对话框并按照下面的屏幕截图进行配置。参数文本框旁边的箭头按钮显示有关 Visual Studio 可以为正在配置的工具提供的信息的详细信息。

下面配置的参数是:/e /u /wl /dl %6 /dr %7 %1 %2 %4
Configure Tool for Merge Operation

比较和合并操作现在应该配置为使用 WinMerge。

Configured User Tools

WinMerge 命令行选项

WinMerge 包含多个 command line options .以下是上面配置中使用的那些。

/e 使 WinMerge 能够通过按一次 Esc 键关闭。

/u 防止 WinMerge 添加左侧或右侧
最近使用 (MRU) 列表的文件路径。

/wl 以只读方式打开左侧。

/wr 以只读方式打开右侧。

/dl 左侧标题栏的说明。

/博士右侧标题栏的说明。

终于有一个不错的差异了!

现在 Visual Studio 中的比较更有意义,它显示差异的数量、它们在比较文件中的位置以及每行的实际差异。 WinMerge 支持自定义语法着色和差异着色。

Visual Studio Team System with WinMerge

个人备注:

我对其进行了测试,但无法对本地文件进行更改,因此我在删除 /wr 的页面上遵循了 Youen 的建议。比较操作的参数,现在效果很好!

关于visual-studio-2010 - 我可以在 Visual Studio 中使用 WinMerge 作为我的合并/差异工具吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27859199/

相关文章:

c# - 如何将用户控件添加到面板

windows - Git diff 在子模块中不起作用

regex - 如何使用 winmerge 行过滤器忽略包含特定单词的行?

visual-studio - TFS:如何在 Visual Studio 2019 中添加撤消更改操作?

windows - 系统与用户 PATH 环境变量...仅当我将路径添加到用户 PATH 时,winmerge 才有效

c++ - 如何从 Windows 中的 Image 对象获取像素信息?

c# - VSTO 开发 - VS2010/.NET 4.0 中的主要改进?

visual-studio-2010 - VS 2010 中的 MS 单元测试,测试方法 [我的方法] 抛出异常 : . ..,WT*?

azure - 如何将现有 TFVC 存储库导入 Azure DevOps 项目?

azure-devops - 使用 API 以编程方式在 Azure DevOps Pipeline 中添加和更新测试