SQL Server - Programmatically adding a SSIS component to the toolbox
Asked By j.mulder
06-Sep-07 10:54 AM

I am trying to create an installation package for a BI solution which
uses custom SSIS components. I would like to add the custom SSIS
components to the "Data Flow Transformations" tab page of the toolbox
of the Business Intelligence Development Studio from the installer. I
have tried to accomplish this with the following piece of code:
public void AddToolboxItem(string toolboxTabName, string
toolBoxItemName, string toolBoxItemPath)
{
Type dteReference;
EnvDTE.ToolBox toolBox;
EnvDTE80.ToolBoxItem2 addedToolBoxItem;
// Get a reference to the visual studio development
environment.
dteReference = Type.GetTypeFromProgID("VisualStudio.DTE.
8.0");
if(dteReference != null)
{
// Get a reference to the toolbox of the development
environment.
EnvDTE80.DTE2 dte =
(EnvDTE80.DTE2)Activator.CreateInstance(dteReference);
toolBox =
(EnvDTE.ToolBox)dte.Windows.Item("{B1E99781-AB81-11D0-
B683-00AA00A3EE26}").Object;
// Loop through all tab pages to find the toolbox tab
page that was specified
// in the toolboxTabName parameter.
foreach (EnvDTE80.ToolBoxTab2 toolBoxTab in
toolBox.ToolBoxTabs)
{
if(toolBoxTab.Name.ToLower() ==
toolboxTabName.ToLower())
{
// The specified toolbox tab page was found.
// First check if the
// component is not already in the toolbox.
foreach(EnvDTE80.ToolBoxItem2 toolBoxItem in
toolBoxTab.ToolBoxItems)
{
if (toolBoxItem.Name == toolBoxItemName)
{
string name = toolBoxItem.Name;
string objectText =
toolBoxItem.ToString();
return;
}
}
// The toolbox item is not in the toolbox tab
page. Now we can add it.
addedToolBoxItem =
(EnvDTE80.ToolBoxItem2)toolBoxTab.ToolBoxItems.Add(toolBoxItemName,
toolBoxItemPath,
EnvDTE.vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
return;
}
}
}
}
I can get a reference to the "Data Flow Transformations" ToolBoxTab,
but adding an item to it fails without generating an error.
Is there any way to programmatically add a SSIS component to the
toolbox?
Kind regards,
Joost Mulders
Type.GetTypeFromProgID
(1)
EnvDTE80.ToolBoxItem2
(1)
EnvDTE80.ToolBoxTab2
(1)
SQL Server
(1)
EnvDTE.ToolBox
(1)
Activator.CreateInstance
(1)
ToolBoxTab.Name.ToLower
(1)
ToolBoxTab.ToolBoxItems
(1)
jjcamulder replied...
The more compact version of the cody I am trying to use:
Type dteReference;
EnvDTE.ToolBox toolBox;
EnvDTE80.ToolBoxItem2 addedToolBoxItem;
dteReference = Type.GetTypeFromProgID("VisualStudio.DTE.8.0");
if(dteReference != null)
{
EnvDTE80.DTE2 dte =
(EnvDTE80.DTE2)Activator.CreateInstance(dteReference);
toolBox = (EnvDTE.ToolBox)dte.Windows.Item("{B1E99781-AB81-11D0-
B683-00AA00A3EE26}").Object;
foreach (EnvDTE80.ToolBoxTab2 toolBoxTab in toolBox.ToolBoxTabs)
{
if(toolBoxTab.Name.ToLower() == "data flow transformations")
{
foreach(EnvDTE80.ToolBoxItem2 toolBoxItem in
toolBoxTab.ToolBoxItems)
{
if
(toolBoxItem.Name ==
return;
}
addedToolBoxItem =
(EnvDTE80.ToolBoxItem2)toolBoxTab.ToolBoxItems.Add(FlowSync,
@"C:\Program Files\Microsoft SQL Server\90\DTS\PipelineComponents
\FlowSync.dll",
EnvDTE.vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
return;
}
}
}
MSDE on Windows 2003 R2 box, new DL385G6 - Install Fails during SQL Services SQL Server I have been finding that I am having trouble with the Crystal Reports Server XI installation failing when it is dealing with SQL. So, as a thought and in case there was something wrong with my SQL portion of the isntall. I thought ok, I will try installing the actual MSDE application direct from Microsoft. So, I downloaded the MSDE for SQL 2000 (which is msde2000a.exe), set my switches and off to the races. It quit seconds left to the installation and bombed with the same errors as the Crystal Reports Server install. The error is the same whether I try to install MSDE by itself or
Why_can’t_recursive_queries_contain. . .? SQL Server hi I hope I didn = 92t put too many questions 1) Why can = 92t recursive queries also be unioned together with UNION operator ( instead they must use UNION ALL )? thanx SQL Server Programming Discussions SQL Server 2008 (1) SQL Server 2005 (1) SQL Server 2000 (1) SQL Server (1) Oracle (1) Ruby (1) MichaelcoAToptonlineDOTnet (1
KB948110 / MS08-040, SQL 2000 & sa authentication SQL Server Hi everyone, I'm having an issue installing KB948110 / MS08-04 security patch for SQL Server 2000 Standard. I'm getting the message: 1 or more SQL Server instances could not verify your account information when I provide sql authentication details when installing this patch. We have installed SQL Server 2000 STD on a
SQL Express: Failed Reinstall SQL Server Dear Setup Experts: I am trying to reinstall SQL Express after playing with it some. I uninstalled it, and now, it refuses to reinstall in the face. Any ideas what this log file means and how I can get SQL Express installed? I really do not want to have to reinstall my whole system. * ** ** Start of Log File Overall summary: Final result: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup. Exit code (Decimal): -2068643839 Exit facility code: 1203
Access 2007-> SQL Server2005 "connection was forcibly closed", GNE 1 SQL Server SQL, Server2005, "connection, was, forcibly, closed", GNE, 1" / > Hi, with an Access 2007 application, I have a very big problem connecting an SQL Server 2005. The scenario: - nearly 200 clients with Windows XP Professional (in an Active Directory Domain clients uses WAN, LAN and WLAN, different locations - one SQL Server 2005 EE, uses actually 36 databases, the Access 2007 application uses 2 of them (one