Programmatically Merging using TeamFoundationClient TFS2008 and VS2010

后端 未结 1 805
野性不改
野性不改 2021-01-06 19:24

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.

I have seen several opti

相关标签:
1条回答
  • 2021-01-06 19:52

    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();
    
    0 讨论(0)
提交回复
热议问题