2015-04-29

Create SSIS Custom Control Flow Task Part 1 - Create the Project

Start from here I am going to spend a few posts to introduce my approach for creating a SSIS control flow task. 

Custom component in SSIS gives you lot of flexibilities, and can extend SSIS capacities, can improve code reusability, can improve ETL manageability, blah blah blah…  But because the custom components are created on top of SSIS, there certainly are some troubles. So what I did is create some standard procedures to simplify my job.

Now let me demonstrate my approach through a custom control flow task. The approach starts from solution setup, then goes down to individual project setting, does some coding, and finally a deployment.

The component is created by Visual Studio Express 2012 for Windows Desktop, and essentially, as long as we reference the correct DLLs, the solution can be used for 2008R2, 2012, and 2014.

Custom Control Flow Task requires two assemblies installed in GAC: one is for the Task, which will be called when the task is executed. The 2nd assembly actually contains a winform object for the IDE (BIDS, SSDT, or VS), as well as an UI object for task initialization. So our first task is to have a solution with two class library projects:

Open VS Express and create a class library project. In my demonstration, I named my project to “MyControlFlowTask”.




By default the name of the class in the project is “class1.cs”. It doesn’t make sense in most cases, so I changed the name to “MyControlFlowTask.cs”




Now as I mentioned, we need a 2nd class library project. To make the name consistent, I named the class to “MyControlFlowTask_UI.cs”



In the UI project, I then added a windows form and named it “MyControlFlowTask_Form.cs”.



The solution is ready, now we need to dig into to project level. Let’s begin with project reference

 


The reference we need is Microsoft.SqlServer.ManagedDTS, which can be found at extensions category. Note here version 11 is for 2012, 10.50 is for 2008R2, and 12 is for 2014.



Notice I had System.Windows.Forms referenced as well, by default it is not in the reference list. It is because when the task is executed in the package, I just want to show a messagebox :P (coding is not the most important thing in this series)



Add Microsoft.SqlServer.ManagedDTS into the UI project as well. But this time we need one more reference for Microsoft.SqlServer.Dts.Design.



Now we have done project references. What we need to do is to sign the projects, because after compile these assemblies needs to be added into system GAC.  I will continue the topic in my next post.

No comments :

Post a Comment