我有大约 100 个 SSIS 包,负责将数据从一种产品迁移到另一种产品。这些程序包几乎总是包含至少一个脚本任务和/或脚本组件,它们使用在 .NET 3.5 中构建并具有强命名的自定义 DLL。每次我在包中引用它时,我们都会确保引用的属性“特定版本”设置为 false。在我将 SSIS 包部署到的环境中,DLL 已使用 gacutil.exe 进行了 GAC,并已转储到 SQL Servers 程序集缓存中。
我遇到的问题是我的自定义 DLL 的版本随着 TFS 的每次构建而增加。从我所做的研究来看,引用“特定版本”属性似乎没有效果。由于我们使用 DLL 的 1.0.0.0 进行开发,因此它仍在寻找该版本。我能够解决这个问题的唯一方法是在 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
最佳答案
特定版本不用于该目的。您需要在配置文件中设置绑定(bind)策略,这将使一个程序集版本号在运行时被接受以代替另一个。查看this link - 它比我能更好地解释一切。
关于c# - SSIS 2008 : Using Custom DLL's in Script Task/Script Components that are versioned,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19169226/