Monday, November 20, 2017

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")
  6. Install it (see my post)
  7. Add Icon to this Task

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;}}"
get-set
STEP 5: create a strong key for this dll and attache with it! (see image for all - "Strong Name Key")
  • NOW BUILD the SOLUTION
  • 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>.." [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 BUILD the SOLUTION
  • now the dll is ready to install in GAC .. check my post to install this dll as SSIS Task
Strong Name Key

1 comment:

  1. Nothing Is Bug …: Create Ssis Custom Task With Complete Example >>>>> Download Now

    >>>>> Download Full

    Nothing Is Bug …: Create Ssis Custom Task With Complete Example >>>>> Download LINK

    >>>>> Download Now

    Nothing Is Bug …: Create Ssis Custom Task With Complete Example >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete