【问题标题】:MS Office file diff under TFSTFS 下的 MS Office 文件差异
【发布时间】:2023-03-09 19:57:01
【问题描述】:

当您在 Team Foundation Server 源资源管理器中比较两个版本的 MS Word doc/Excel 书籍时,结果是无聊的“二进制填充不同”对话框。

但不一定非得如此。相关应用程序(Word/Excel)具有出色的内置差异界面。当您使用启用了版本控制的 SharePoint 文件库并与以前的版本进行比较时,您可以看到它。此外,TortoiseSVN 会在您进行 diff 时显示它。

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

【问题讨论】:

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


    【解决方案1】:

    您可以为每个文件类型(扩展名)配置比较 (diff) 和合并工具。这可以通过工具 -> 选项 -> 源代码管理 -> 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

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

    【讨论】:

    • 我将diff-doc.js 的副本保存到一个目录以用作命令,并为其提供参数“%1 %2”。效果很好。
    • 只是为了扩展@DanielBallinger 所说的,实际上有许多文件格式(Word、Excel、Powerpoint、exe/dll 等)here 的脚本。
    • 刚刚尝试查找@sclarke81 提到的脚本 - 但由于它们已从 code.google.com 移出 - 现在可以在 svn.osdn.net 找到它们
    【解决方案2】:

    您也可以在 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

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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 2013-02-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多