【发布时间】:2016-06-17 12:21:55
【问题描述】:
我尝试在script compoment 中的ssis 中使用我自己的.dll。正常程序给我一个错误:"could not load file or assembly 'xxx' or one of its dependencies. The system cannot find the file specified."
我尝试过的是我去项目 -> 在资源管理器中打开并将我的 .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
标签: vb.net ssis script-component