我正在通过 Biml(根据 Varigence BimlExpress page 使用当前版本的 BimlExpress)创建一个 SSIS 项目,该项目在数据流任务中使用脚本组件。该项目创建时没有问题,但是在到达脚本组件时出错:
Could not load file or assembly 'Microsoft.SqlServer.DTSPipelineWrap, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
at ScriptMain.PreExecute() at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
我可以在 GAC 中看到这个 dll,当我尝试手动添加引用时,SSIS 指出我无法添加它,因为它已经包含在项目中。
但是,如果我打开脚本组件并手动构建
它 - 但不做任何更改 - 数据流任务将顺利运行。
澄清一下,我知道我没有改变任何其他东西,因为每次我想测试一种新方法时,我都会从 Biml 重新创建这个项目,它提供了一致的基线。
有谁知道为什么包含对 GAC dll 的引用的脚本组件只能在手动构建
而不是事先构建时工作?
虽然在不同的环境中,但我以前毫无问题地使用过这个确切的 Biml。已针对 SQL Server 2016 实例使用 Visual Studio 2012,但未在针对 SQL Server 2016 实例的 Visual Studio 2015(目标 2012)中使用。
为了进一步了解上下文,我还测试了此输出针对 SQL Server 2012、2014 和 2016 的 SSIS 项目,并显示完全相同的错误消息。
更新
这看起来肯定是项目中的 dll 版本问题,作为 BimlExpress 的输出,因为如果我手动创建 v4.0_14.100.0.0__89845dcd8080cc91
文件夹,其中包含版本 13 dll,位于 C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SqlServer.DTSPipelineWrap
脚本组件现在出现以下错误:
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{ID removed just in case}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100 wrapper)
最佳答案
我猜你的问题可能与 Express 版本有关。
在相关页面查看Express和BimlStudio版本之间的差异(“与BimlStudio比较”按钮下的功能比较表):
关于c# - SSIS 脚本组件在手动打开之前无法加载程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45239315/