Hi,
I'm trying to add a new tab and my controls programatically to visual studio 2010.
Its creating tab but its not adding the controls to tab.
DTE DesignTimeEnvironment = (DTE)Activator.CreateInstance(Type.GetTypeFromProgID("VisualStudio.DTE.10.0"), true);
ToolBox VSToolBox = (ToolBox)DesignTimeEnvironment.Windows.Item("{B1E99781-AB81-11D0-B683-00AA00A3EE26}").Object;
ToolBoxTab MyTab = null;
string TabName = "MyComponents";
foreach (ToolBoxTab VSTab in VSToolBox.ToolBoxTabs)
{
if (VSTab.Name == TabName)
{
MyTab = VSTab;
break;
}
}
if (null == MyTab)
MyTab = VSToolBox.ToolBoxTabs.Add(TabName);
MyTab.Activate();
ToolBoxItem tbi = MyTab.ToolBoxItems.Add("FileBrowser",
@"MyComponents.FileBrowser, MyTestComps, Version=1.0.0.1, Culture=neutral, PublicKeyToken=2283de3658476795",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
DesignTimeEnvironment.Quit();
If i run as administrator its working fine, adding Controls to control library,
but when I try to add the library which is not in GAC its not working. It doesn't through any exception.
Ex:
ToolBoxItem tbi = MyTab.ToolBoxItems.Add("FileBrowser",
@"C:\MyComponents\MyTestComps.dll",
vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);