我有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);
是否可以显示合并的对话框模式(我认为是diffmerge.exe)并显示结果(解决冲突)?注意:就我而言,现在,我想要显示合并工具。
TFS API MergeContent returns false without showing merge tool
有tf命令(命令行,不是C ##
tf diff [erence] itemspec [/ version:versionspec]
tf merge [/递归] [/ force] [/候选] [/ discard]
[/ version:versionspec] [/ lock:none | checkin | checkout] [/ preview]
[/ baseless] [/ nosummary] [/ noimplicitbaseless] [/保守]
[/格式:(简短|详细)] [/无提示] [/登录名:用户名,[密码]]
源目的地
TF解析[itemspec]
[/ auto:((AutoMerge | TakeTheirs | KeepYours |
OverwriteLocal | DeleteConflict
| KeepYoursRenameTheirs)]
[/ preview] [(// overridetype:overridetype | / converttotype:converttype]
[/递归]
[/ newname:path] [/ noprompt]
[/ login:用户名,[密码]]
有关合并文件的任何建议,并且必须选择:
1)显示合并对话框(diffmerge)
2)自动,没有用于合并(扩散或其他?)和解决冲突的显示对话框。
最佳答案
从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/