Ok, thanks for this way, but if I have a project in Framework 3.5, VS2010 doesn't stop on my break point.
But if I change the Framework to 4, VS2010 stop on the breakpoint. But CreateToolWindow2 raise an exception, because isn't the same Framework !
I simplify the code as minimum :
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param term='application'>Root object of the host application.</param>
/// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param term='addInInst'>Object representing this Add-in.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_addInInstance = (AddIn)addInInst;
_applicationObject = (DTE2)_addInInstance.DTE;
if (connectMode == ext_ConnectMode.ext_cm_Startup)//ext_ConnectMode.ext_cm_UISetup)
{
}
}
/// <summary>Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.</summary>
/// <param term='custom'>Array of parameters that are host application specific.</param>
/// <seealso class='IDTExtensibility2' />
public void OnStartupComplete(ref Array custom)
{
Windows2 win2 = this._applicationObject.Windows as Windows2;
if (win2 != null)
{
Assembly asm = Assembly.GetExecutingAssembly();
AddIn addinobj;
addinobj = this._applicationObject.AddIns.Item(1);
object controlObject = null;
Guid id = new Guid("4c410c93-d66b-495a-9de2-99d5bde4a3b9"); // this guid doesn't seem to matter?
//Window
Window windowTool = win2.CreateToolWindow2(addinobj,
asm.Location,
"MyAddinASupp.UserControl1", "Zone de test",
"{" + id.ToString() + "}",
ref controlObject);
windowTool.Visible = true;
}
}