【问题标题】:How to get custom dll's working in a ssis script component?如何让自定义 dll 在 ssis 脚本组件中工作?
【发布时间】: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


【解决方案1】:

在将其添加到 GAC 之前,您需要对其进行强命名,例如:http://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html

【讨论】:

    【解决方案2】:

    您需要通过运行 gacutil -i assembly.dll 将程序集添加到 GAC(全局程序集缓存)

    更多信息可以在这里找到

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

    【讨论】:

      猜你喜欢
      • 2013-10-10
      • 1970-01-01
      • 2011-01-12
      • 1970-01-01
      • 2021-01-29
      • 2021-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多