我嘗試在ssis
之內的script compoment
中使用我自己的.dll。正常的程序給我一個錯誤:"could not load file or assembly 'xxx' or one of its dependencies. The system cannot find the file specified."
如何讓自定義的dll在ssis腳本組件中工作?
我試過的是我去項目 - >在資源管理器中打開,並將我的.dll到bin文件夾,但同樣的錯誤發生。
我發現this C# Code並轉換爲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
但是我沒有Micorosoft.SqlServer.Dts.**Tasks**
。任何人誰可以幫助我得到這個腳本工作或可以提供另一種解決方案,讓我的DLL運行在script compoment
?
有一點需要注意,事件訂閱應該像這樣完成:'AddHandler AppDomain.CurrentDomain.AssemblyResolve,AddressOf CurrentDomain_AssemblyResolve' –
可能是[duplicate](http://stackoverflow.com/questions/11611165/add-third-party-dll-reference-in-ssis-script-component/11614009#11614009) – billinkc