Loading custom assemblies into SSIS Script Task without installing them into GAC - Part 1

October 7, 2015 | | Tags : SQL SSIS Script Task Assembly


Recently I came across the article by David Browne, describing how to reference a custom assembly in a SSIS Script task or Script component without having to install it into a Global Assembly Cache (GAC). Since I want to use custom assemblies in some of my SSIS projects, I loved the idea to be less dependent on a particular server software configuration, and not having to load assemblies into a GAC of each server that the SSIS package might need to run.

I followed the instructions in the article, set up a simple SSIS package with just a Main() method and ran it. But my code would not run and throw an “exception has been thrown by the target of an invocation” from a Reflection. I realized that what happens is that when the Main method is loaded by a Reflection, none of my custom assemblies have been loaded yet, and therefore the required reference to a custom assembly does not exist yet.

So when I moved all of the logic that requires the use of custom assemblies into a different method, leaving the Main be just an entry point, the code worked.

Comments