使用TeamFoundationClient TFS2008和VS2010以编程方式合并

我有VS 2010的Addin VS(可能在未来的VSIX中)。我想做任何单个文件(sql文件)的分支,然后以编程方式进行合并。

我见过几个选择:

GetStatus status = workspace.Merge 

如何以编程方式合并TFS更改集?

http://blogs.microsoft.co.il/shair/2009/04/20/tfs-api-part-19-merge/

 MergeContent(Conflict, true); 

workspace.Merge可以显示合并的对话模式(我认为是diffmerge.exe)并显示结果(解决冲突)? 注意:在我的情况下,现在,我想要显示合并工具。

TFS API MergeContent返回false而不显示合并工具

有tf命令(命令行,而不是C ##

tf diff [erence] itemspec [/ version:versionspec]

合并[/ recursive] [/ force] [/候选人] [/ discard] [/ version:versionspec] [/ lock:none | checkin | checkout] [/ preview] [/ baseless] [/ nosummary] [/ noimplicitbaseless] [/保守] [/格式:(简要|详细)] [/ noprompt] [/ login:username,[password]]来源目的地

解析[itemspec]

[/自动:(AutoMerge | TakeTheirs | KeepYours |

OverwriteLocal | DeleteConflict

| KeepYoursRenameTheirs)]

[/ preview] [(/ overridetype:overridetype | / converttotype:converttype] [/ recursive]

[/ newname:path] [/ noprompt]

[/ login:username,[password]]

有关合并文件的任何建议,还有以下选项:

1)显示合并对话框(diffmerge)

2)自动,没有显示对话用于合并(diffmerge或其他?)和解决冲突。

从Visual Studio安装目录复制vsDiffMerge.exe C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ IDE在App Exe文件中

 var mergetool = new ThirdPartyToolDefinition(".*",ToolOperations.Merge,"vsDiffMerge.exe","","/m %1 %2 %3 %4"); var toolcol= ThirdPartyToolDefinitionCollection.Instance.FindTool(".*",ToolOperations.Merge); if (toolcol == null) { ThirdPartyToolDefinitionCollection.Instance.AddTool(mergetool); ThirdPartyToolDefinitionCollection.Instance.PersistAllToRegistry(); } var controlsAssembly = Assembly.GetAssembly(typeof(ControlAddItemsExclude)); var vcResolveCoinflictsDialogType = controlsAssembly.GetType("Microsoft.TeamFoundation.VersionControl.Controls.DialogResolveConflicts"); var ci = vcResolveCoinflictsDialogType.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, new[] { typeof(Workspace), typeof(string[]), typeof(bool) }, null); var resolveCoinflictsDialog = (Form)ci.Invoke(new object[] { workspace, null, true }); resolveCoinflictsDialog.ShowDialog(parent); ThirdPartyToolDefinitionCollection.Instance.Remove(mergetool); ThirdPartyToolDefinitionCollection.Instance.PersistAllToRegistry();