我需要比较我的项目中的两个文件,它是用 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 …
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 中的菜单。
点击 配置用户工具... 和“配置用户工具”对话框
将可用。
添加比较工具的 WinMerge 详细信息。点击 添加... 上的按钮配置用户工具 对话框并按照下面的屏幕截图进行配置。参数文本框旁边的箭头按钮显示有关 Visual Studio 可以为正在配置的工具提供的信息的详细信息。
下面配置的参数是:/e /u /wl /wr /dl %6 /dr %7 %1 %2
添加合并工具的 WinMerge 详细信息。点击 添加... 上的按钮配置用户工具 对话框并按照下面的屏幕截图进行配置。参数文本框旁边的箭头按钮显示有关 Visual Studio 可以为正在配置的工具提供的信息的详细信息。
下面配置的参数是:/e /u /wl /dl %6 /dr %7 %1 %2 %4
比较和合并操作现在应该配置为使用 WinMerge。
WinMerge 命令行选项
WinMerge 包含多个 command line options .以下是上面配置中使用的那些。
/e 使 WinMerge 能够通过按一次 Esc 键关闭。
/u 防止 WinMerge 添加左侧或右侧
最近使用 (MRU) 列表的文件路径。
/wl 以只读方式打开左侧。
/wr 以只读方式打开右侧。
/dl 左侧标题栏的说明。
/博士右侧标题栏的说明。
终于有一个不错的差异了!
现在 Visual Studio 中的比较更有意义,它显示差异的数量、它们在比较文件中的位置以及每行的实际差异。 WinMerge 支持自定义语法着色和差异着色。
个人备注:
我对其进行了测试,但无法对本地文件进行更改,因此我在删除/wr
的页面上遵循了 Youen 的建议。比较操作的参数,现在效果很好!
关于visual-studio-2010 - 我可以在 Visual Studio 中使用 WinMerge 作为我的合并/差异工具吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27859199/