3

我有大约 100 个 SSIS 包,负责将数据从一种产品迁移到另一种产品。这些包几乎总是包含至少一个脚本任务和/或脚本组件,这些脚本任务和/或脚本组件使用在 .NET 3.5 中构建并具有强名称的自定义 DLL。每次我在包中引用它时,我们都会确保引用的属性“特定版本”设置为 false。在我将 SSIS 包部署到的环境中,该 DLL 已使用 gacutil.exe 进行 GAC 处理,并转储到 SQL Server 程序集缓存中。

我遇到的问题是我的自定义 DLL 版本随着 TFS 的每次构建而增加。从我所做的研究看来,引用“特定版本”属性似乎没有效果。由于我们使用 1.0.0.0 的 DLL 开发,它仍在寻找该版本。我能够解决这个问题的唯一方法是在 SSIS 包中打开每个需要它的脚本任务并简单地保存。这不是一个可行的选择。我还发现了一篇博客文章(http://dougbert.com/blog/post/Recompile-VSTA-scripts-programmatically-in-SSIS.aspx),它可以让我们自动执行该操作,但需要执行 100 多个 SSIS 包这将花费太多时间保存/更新我所有的 SSIS 包

注意:我也在使用 C# api 执行 SSIS 包。

我在找什么:

  • 任何允许我们在 SSIS 脚本任务/脚本组件中继续使用版本化 DLL 的解决方案
  • 如果在没有 SSIS 2012 的情况下解决了此问题

以下是我得到的错误:

Error in Microsoft.SqlServer.Dts.Runtime.TaskHost/ : 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'CustomDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=119c04fbde27c5df' or one of its dependencies. The system cannot find the file specified.
File name: 'CustomDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=119c04fbde27c5df'
   at ST_240ac16d255540ce822401f59c67e591.csproj.ScriptMain.Method1()
   at ST_240ac16d255540ce822401f59c67e591.csproj.ScriptMain.Main()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
   at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()</c
4

1 回答 1

1

特定版本不用于此目的。您需要在配置文件中设置绑定策略,这将使一个程序集版本号能够在运行时代替另一个程序集版本号被接受。看看这个链接——它比我解释的要好得多。

于 2013-10-07T14:27:46.487 回答