如何让自定义 dll 在 ssis 脚本组件中工作?
How to get custom dll's working in a ssis script component?
我尝试在 ssis
中的 script compoment
中使用我自己的 .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**
。任何可以帮助我使该脚本正常工作或可以提供另一种解决方案以在 script compoment
?
中获取我的 dll 运行 的人
您需要通过 运行 gacutil -i assembly.dll
将程序集添加到 GAC(全局程序集缓存)
可以在此处找到更多信息
https://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.100).aspx
在将其添加到 GAC 之前,您需要为其命名,示例如下:http://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html
我尝试在 ssis
中的 script compoment
中使用我自己的 .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**
。任何可以帮助我使该脚本正常工作或可以提供另一种解决方案以在 script compoment
?
您需要通过 运行 gacutil -i assembly.dll
将程序集添加到 GAC(全局程序集缓存)可以在此处找到更多信息
https://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.100).aspx
在将其添加到 GAC 之前,您需要为其命名,示例如下:http://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html