Addin: How-to Do Merge programmatically

58 Views Asked by At

I use 2012 and VS 2010. I have Addin VS.

I want do Merge of a ítem (sql file).

I use the following code, but I get COMException exception:

Command "File.TfsContextExplorerMerge" is not available

My source code mehtod:

public static void DoMerge(DTE2 app)        
{            
    if (app.SelectedItems.Count != 1 || app.SelectedItems.Item(1).ProjectItem.FileCount != 1) return;            
    var projectItem = app.SelectedItems.Item(1).ProjectItem;            
    var proyectoSW = projectItem.ContainingProject;             

     string path = projectItem.get_FileNames(1);            
     if !(path.ToLower().EndsWith(".sql")) return;       

     try            
     {                
         projectItem.DTE.ExecuteCommand("File.TfsContextExplorerMerge");            
     }            
     catch (System.Runtime.InteropServices.COMException)           { }        
}

Any suggestions about it?

1

There are 1 best solutions below

0
On

use window _applicationObject.MainWindow.DTE.ExecuteCommand respectively;;