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

标签 c# tfs merge

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

我看到了几个选项:

GetStatus status = workspace.Merge

How to merge TFS change sets programmatically?

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

MergeContent(Conflict, true);

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

TFS API MergeContent returns false without showing merge tool

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

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

tf merge [/recursive] [/force] [/candidate] [/discard] [/version:versionspec] [/lock:none|checkin|checkout] [/preview] [/baseless] [/nosummary] [/noimplicitbaseless] [/conservative] [/format:(brief|detailed)] [/noprompt] [/login:username,[password]] source destination

tf resolve [itemspec]

[/auto:(AutoMerge|TakeTheirs|KeepYours|

OverwriteLocal|DeleteConflict

|KeepYoursRenameTheirs)]

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

[/newname:path] [/noprompt]

[/login:username, [password]]

关于合并文件的任何建议,以及必须的选项:

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

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

最佳答案

从 visual studio 安装目录 C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE 中的 App Exe 文件中复制 vsDiffMerge.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();

关于c# - 使用 TeamFoundationClient TFS2008 和 VS2010 以编程方式合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27194811/

相关文章:

c# - jQuery AJAX 总是执行错误 : {}

visual-studio-2012 - 如何查看 "Get Latest Version"之后的变化?

svn - 您如何获得 Subversion 差异摘要以忽略 mergeinfo 属性?

git - merge Bitbucket 中的两个分支

java - PDF 压缩 - HTML 到 PDF (wkhtmltopdf)

c# - 使用 .Net 客户端应用程序中的 B2C 登录策略

c# - 数据绑定(bind)后如何将图像设置为数据 GridView 单元格?

c# - 在 C# 中迭代​​动态修改列表

c# - 获取用户参与的特定项目

tfs - 运行位于 TFS 源代码管理中的 Powershell 脚本