问题描述
我有用于VS 2010的Addin VS(也许在将来的VSIX中).我想做任何单个文件(sql文件)的分支,以后再以编程方式合并.
I have Addin VS (maybe in future VSIX) for VS 2010.I want to do branch of any single files (sql files) and later do merge programmatically.
我看到了几种选择:
GetStatus status = workspace.Merge
http://blogs.microsoft.co.il/shair/2009/04/20/tfs-api-part-19-merge/
MergeContent(Conflict, true);
workspace.Merge可以显示用于合并的对话框模式(我认为是diffmerge.exe)并显示结果(解决冲突)?注意:就我而言,现在,我想要显示合并工具.
workspace.Merge can show dialog modal for merge (diffmerge.exe I think) and show results (resolveing conflicts) ? Note: in my case, now, I want show merge tool.
TFS API MergeContent返回false而不显示合并工具
有tf命令(命令行,而不是C ##
There are tf commands (command line, not C##
tf merge [/递归] [/force] [/候选] [/discard] [/version:versionspec] [/lock:none | checkin | checkout] [/preview] [/baseless] [/nosummary] [/noimplicitbaseless] [/保守] [/格式:(简要|详细)] [/无提示] [/登录名:用户名,[密码]] 源目的地
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解析[itemspec]
tf resolve [itemspec]
[/auto:((AutoMerge | TakeTheirs | KeepYours |
[/auto:(AutoMerge|TakeTheirs|KeepYours|
OverwriteLocal | DeleteConflict
OverwriteLocal|DeleteConflict
| KeepYoursRenameTheirs)]
|KeepYoursRenameTheirs)]
[/preview] [(/overridetype:overridetype |/converttotype:converttype] [/递归]
[/preview] [(/overridetype:overridetype | /converttotype:converttype] [/recursive]
[/newname:path] [/noprompt]
[/newname:path] [/noprompt]
[/login:用户名,[密码]]
[/login:username, [password]]
有关合并文件的任何建议,并且必须有以下选择:
any suggestions for do merging of files, and have to options:
1)显示用于合并(扩散)的对话框
1) show dialog for merging (diffmerge)
2)自动,没有用于合并(扩散或其他?)和解决冲突的显示对话框.
2) auto, without show dialog for merging (diffmerge or another?) and resolving conflicts.
推荐答案
从Visual Studio安装目录C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ IDE复制Visual Studio安装目录中的vsDiffMerge.exe
copy vsDiffMerge.exe from visual studio installation dir C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE inside App Exe file
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();
这篇关于使用TeamFoundationClient TFS2008和VS2010以编程方式合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!