I've got this to work using a very basic example(outlined below) and I want to see if other SOers have experience doing what I'm attempting...using a 3.5 framework assembly in a Script Task in SSIS 2005.
I've basically followed the page found here... except I targeted the 3.5 framework while in Visual Studio 2008.
Write/compile your code (targeted the 3.5 framework) Just some simple Linq so that I'm using a greater than 2.0 framework feature
using System; using System.Collections.Generic; using System.Text; using System.Linq; namespace Ext { public class Extend { public string GetValue () { /* Test Linq to "prove" that we're not running against the 2.0 framework. I know this code could be improved, but bear with me... it's throwaway code just to test the concept */ string [] teststring = new string [3]; teststring[0] = "named Extend"; string returnString = String.Empty; var s = teststring.Where(x => x.ToString() == "named Extend"); foreach (var x in s) { returnString = x.ToString(); } return "Extending Script Task through a custom library " + returnString; } } }
- Gave it a Strong Name key
- Added the assembly to the GAC using gacutil
- Copied the assembly to the C:\Windows\Microsoft.NET\Framework\v2.0.50727 folder...dev
machine is running Windows 7 - Created a Script Task and added a reference to the assembly
In the Script Task
Dim x As New Extend() MsgBox(x.GetValue.ToString())
It works OK cuz when I run the SSIS project I get back a message box with the text
"Extending Script Task through a custom library named Extend"
So...my question is will the SSIS project/Script Task still work when I try to do more sophisticated stuff...especially when I call my (yet to be written) assembly that uses LinqToEntities?
It seems strange to me that I have to copy the file to the Framework 2.0 folder AND add it to the GAC...but maybe it's just a weird SSIS requirement...I know I can't add the reference in the Script Task unless that assembly's in the Framework 2.0 folder...