0

I try to use my own .dll in a script compoment within ssis. The normal procedure gives me an error: "could not load file or assembly 'xxx' or one of its dependencies. The system cannot find the file specified."

What I tried yet is I went to project -> Open in Explorer and put my .dll into the bin folder but that same error occures.

I found this C# Code and converted it to vb.net:

<Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute> _
Public Partial Class ScriptMain
    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    Shared Sub New()
        AppDomain.CurrentDomain.AssemblyResolve += New ResolveEventHandler(AddressOf CurrentDomain_AssemblyResolve)
    End Sub
    Private Shared Function CurrentDomain_AssemblyResolve(sender As Object, args As ResolveEventArgs) As System.Reflection.Assembly
        If args.Name.Contains("ssisHelper") Then
            Dim path As String = "c:\temp\"
            Return System.Reflection.Assembly.LoadFile(System.IO.Path.Combine(path, "ssisHelper.dll"))
        End If
        Return Nothing
    End Function
End Class

But I do not have Micorosoft.SqlServer.Dts.**Tasks**. Anyone who can help me either get this script working or can provide another solution to get my dll running within the script compoment?

ruedi
  • 5,365
  • 15
  • 52
  • 88
  • A little side note, the event subscription should be done like this: `AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf CurrentDomain_AssemblyResolve` – Visual Vincent Jun 17 '16 at 12:42
  • Probably a [duplicate](http://stackoverflow.com/questions/11611165/add-third-party-dll-reference-in-ssis-script-component/11614009#11614009) – billinkc Jun 17 '16 at 13:28

2 Answers2

0

You need to add the assembly to the GAC (Global Assembly Cache) by running gacutil -i assembly.dll

More information can be found here

https://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.100).aspx

Adam Parker
  • 156
  • 1
  • 14
0

And before adding it to the GAC you need to strong name it, example here: http://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html

Joost
  • 1,873
  • 2
  • 17
  • 18