Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Create SSIS Custom Task with complete example

Here i am sharing the easiest way to create a Ssis Custom task.. this a "Hello World" Task.
by following this way can can create your own task very easily. also i have uploaded the solution folder, so you can modify it to create your own one.

also see my other posts to know more about SSIS custom task like a UI, Tabs on UI, Icon for your custom task etc..

Theory (be patience..)
Follow below 5 simple steps..

  1. create a blank project (.dll/library type project)
  2. add some fixed code/reference, you can say header. (Image-"Blank Project with Task Info")
  3. override 3 procedures of inherited class "Task". (Image - "Override Procedures")
  4. prepare get/set for input/output variables -- [this will be available in the expression option of SSIS task property!] (Image - "get-set")
  5. create a strong key for this dll and attache with it! (Image - "Strong Name Key")
Detail description on above steps ...

STEP 1: create a blank "Class Library" application in visual studio. for example "Test_Task".

STEP 2: add some fixed code, you can say header.

  • Add Reference : add reference "Microsoft.SQLServer.ManagedDTS". you can find it on sql-server installed location ... "..\100\SDK\Assemblies\*.dll" (my case)
  • Use Reference: add on top "using Microsoft.Sqlserver.Dts.Runtime;"
  • Add Task Info
    • add "[assembly: CLSCompliant(true)]" outside of namespace. see image.
    • add below property for task - "[DtsTask(name="value",...)]", inside namespace but outside of class. see image
    • Inherit the class "Task"
    • see image "Blank Project with Task Info
      Blank Project with Task Info
STEP 3: override 3 procedures
  • Inherit the class "Task"
  • declare a variable to use .. my case - "private string text="Hello World SSIS...";"
  • Now override 3 procedures of Task class .. Validate, InitilizeTask & Execute
  • add code of lines from the image "override procedures".
    • you can modify as you want
Override Procedures
STEP 4: prepare get/set for input/output variables
  • prepare get-set for your variables ... see image "get-set"
  • in my case this is "public string TestInput { get { return this.txet;} set { this.txet = value;}}"
STEP 5: create a strong key for this dll and attache with it! (see image for all - "Strong Name Key")
  • a .dll file will be available in the debug OR release folder. thats out required .dll file :)
  • go to "project properties". [on solution explorer ->right click on solution-> click properties]
  • click -> "Signing" tab
  • check "Sign the assembly"
  • select ".." [new window will open]
  • un-check "Protect .. Password"
  • give a name for you Stron Name Key (.snk) file in "Key file name".. my case "Test_Task"
  • click "OK"
  • a new item (.snk file) will be available (at bottom) in the "solution explorer". my case "Test_Task.snk"
  • save the solution (ctrl+s)
  • now the dll is ready to install in GAC .. check my post to install this dll as SSIS Task
Strong Name Key

This post first appeared on Nothing Is Bug Free, please read the originial post: here

Share the post

Create SSIS Custom Task with complete example


Subscribe to Nothing Is Bug Free

Get updates delivered right to your inbox!

Thank you for your subscription