TFS下的MS Office文件差异

时间:2011-05-10 20:04:37

标签: visual-studio-2010 tfs ms-word ms-office

在Team Foundation Server Source Explorer中比较两个版本的MS Word doc / Excel book时,结果是无聊的“Binary filles differ”对话框。

虽然不一定如此。相关的应用程序(Word / Excel)具有出色的内置差异界面。您可以在使用启用版本控制的SharePoint文件库时看到它并与之前的版本进行比较。此外,当你做差异时,TortoiseSVN会把它带出来。

问题 - 我可以在TFS中启用吗?

3 个答案:

答案 0 :(得分:9)

您可以为每种文件类型(扩展名)配置比较(差异)和合并工具。这可以通过工具 - >获得。选项 - >源控制 - > Visual Studio Team Foundation Server - >配置用户工具“按钮或通过命令行配置 tf diff /configure

为了设置比较工具,您将指定扩展名(如果您希望将其用于未指定的所有文件,请使用.*),您正在设置的操作(比较或合并),要调用的命令和命令的参数。对于参数,可以使用的变量如下:

%1 = Original file (in diff, the pre-changes file, in merge, the "server" or "theirs" file, the file that is the base file after "their" changes were applied)
%2 = Modified file (in diff, the post-changes file, in merge the "yours" file - the base file with "your" changes applied)
%3 = Base file (in the 3-way merge operation, the file which both "theirs" and "yours" are derived from - the common ancestor.  This doesn't mean it's the version the changes were based from, since this may be a cherry-pick merge)
%4 = Merged file (The output file for the merge operation - the filename that the merge tool should write to)
%5 = Diff options (any additional command-line options you want to pass to your diff tool - this comes into play only when using "tf diff /options" from the command-line)
%6 = Original file label (The label for the %1 file)
%7 = Modified file label (The label for the %2 file)
%8 = Base file label (The label for the %3 file)
%9 = Merged file label (The label for the %4 file)

要使用TortoiseSVN - 它看起来像你想要的那样 - 你可以指定命令作为TortoiseMerge.exe的文件路径

要进行比较,请指定参数:/base:%1 /mine:%2 /basename:%6 /minename:%7

对于合并,请指定参数:/base:%3 /mine:%2 /theirs:%1 /basename:%8 /minename:%7 /theirsname:%6 /merged:%4 /mergedname:%9

可以找到关于各种合并工具(包括其他单词比较工具,如DiffDoc.exe)的参数的此信息和其他信息on James Manning's MSDN blog。您还可以在invoking the word comparison tool from the command line上找到另一个stackoverflow问题。

答案 1 :(得分:1)

您还可以在TFS中使用 WinMerge + xdocdiff插件,应用以下两个步骤:

  1. WinMerge 与VS-TFS关联:http://manual.winmerge.org/Version_control.html#d0e9669

  2. 在WinMerge中启用 xdocdiff插件http://freemind.s57.xrea.com/xdocdiffPlugin/en/index.html

  3. 这样,您还可以使用 xdocdiff 支持的所有文件类型。

答案 2 :(得分:1)

我现在认为最好的方法是使用MS Word比较,这比其他Doc diff工具要好得多(MS Word本机支持比较,但合并除外)。 通过使用(https://github.com/ForNeVeR/ExtDiff)提供的powershell脚本,可以触发MS字比较功能insde TFS比较。为了解决PS执行策略问题,您需要通过添加“ -ExecutionPolicy Bypass”来更改diff-word.cmd中的内容。在介绍了用于.docx比较的“ diff-word.cmd”之后,它运行得很好。