Thursday, August 7, 2014

Using Custom DLL's in an SSIS Script Task


So you've created an awesome class library you want to use in an SSIS package.  Instead of worrying about registering it in the GAC, you can do the following to make sure your code will work in production.

Class Library Setup
  • Target Framework should be .NET Framework 4 for SSIS Packages used in SQL 2012.
  • The Assembly should be signed with a strong key.
Deploying the Assembly
  • After your class library is built and ready to go, copy it to the following locations:
    • C:\Program Files\Microsoft SQL Server\110\DTS\Binn
    • C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn
  • This will ensure the assembly is available whether the package is run in 32 or 64 bit mode
  • If your assembly relies on any other assemblies that are not registered in the GAC, copy them to the aforementioned folders as well.
Referencing the Assembly in a Script Task
  • In the Script Editor (ScriptMain.cs), the assembly can be referenced just like any other assembly
  • In the Solution Explorer Window, right click on References and select "Add Reference..."
  • You will probably have to Browse for the dll, you can browse to any instance of the current version of the dll.  When the package executes it will use the dll in the "DTS\Binn" folder
  • The custom assembly can now be used right in your script task

1 comment:

Please only include comments that add to the substance of the Blog Post:
- Question or request for clarification
- Idea for improvement
- Identifying an issue

Please refrain from promotion.