How to call a .Net assembly in SSIS

Posted by in Sql Server category on for Intermediate level | Points: 250 | Views : 31991 red flag

In this article we will see how we can call or execute methods defined in a dot net assembly.


SSIS has many inbuild control tasks to perform all the possible functionalities, But still sometimes we feel that there may be some of the features that might have resided in a dotnet assembly or when we use third party dot net assemblies we feel the necessity of including them in our packages.

So today with this article we will try to build a small sample where we will include a dotnet assembly and call methods defined in them.

Lets start with opening Visual studio and building a dot net assembly where we will define a method lets say ReverseString and we will include it in our SSIS package and call the method from SSIS.

Open Visual studio, and create a new class library project and name the class file as TPLibrary and add a method called ReverseString which will take an input string and will return the reverse of that.

Next step is in order to use this dll in SSIS we need to put this assembly in GAC so sign it with a strong name key and deploy it in GAC either by drag drop or by using the GACUtil.

Once this is done lets create a new SSIS project, Add a script task on to the design window

Double click on it to open the script task editor, click on Edit Script button to enter into the script task code editor.

On the solution explorer right click on the reference, add reference to the class library which we created

Here we can also pass the input value using SSIS variables.

Close the script code window and click ok to close the editor window.

Now execute the package and you will see the result output, the reverse of the given input in a message box.

And finally on clicking Ok the task turns green indicating that the task got executed successfully.

That's it its very simple right.

Hope you all understood now on how to call a dotnet assembly in SSIS. 

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Madhu Rokkam
Member Level: Bronze
Member Status: Member,MVP
Member Since: 1/13/2011 3:13:20 PM
Country: India
Thanks and Regards Madhu

Login to vote for this post.

Comments or Responses

Posted by: Tripati_tutu on: 2/22/2011 | Points: 25
Good article...
Posted by: Madhu.b.rokkam on: 2/22/2011 | Points: 25
Thanks Tripati

Login to post response

Comment using Facebook(Author doesn't get notification)