We currently have a solution developed using SSIS / C#. The SSIS package (amongst other things) has a script task that uses logic developed in the class libraries. This function
In my case, just calling Assembly.LoadFile
didn't work. What did work was this approach:
Call this in the class constructor:
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
And then have this method, with all the dlls you need:
private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
if (args.Name.Contains("libName.dll"))
return Assembly.LoadFile(System.IO.Path.Combine(_libraryFolder, "libName.dll"));
if (args.Name.Contains("libName2.dll"))
return Assembly.LoadFile(System.IO.Path.Combine(_libraryFolder, "libName2.dll"));
return null;
}
If they are a lot, you may want to refactor that with a List
.