加载ILMerged程序集时出现FileNotFoundException

时间:2016-01-26 18:15:56

标签: c# .net exception ilmerge typeloadexception

我有几个合并为一个的程序集。这是我的命令。

ilmerge /lib:. /keyfile:../../key.snk /targetplatform:v4 /out:..\..\build\Dynamicalabs.QbIntegration.Plugins.dll .\DynamicaLabs.QbIntegration.Plugins.dll  .\Intuit.Ipp.Core.dll .\Intuit.Ipp.Data.dll .\Intuit.Ipp.DataService.dll .\Intuit.Ipp.Exception.dll .\Intuit.Ipp.Security.dll .\Intuit.Ipp.Utility.dll .\Intuit.Ipp.Diagnostics.dll .\Intuit.Ipp.Retry.dll .\Newtonsoft.Json.dll .\DevDefined.OAuth.dll .\DNL.QBIntegration.dll

问题在于。\ Intuit.Ipp.Data.dll程序集。它的名字是。\ Intuit.Ipp.Data.dll,但是在文件属性Intuit.IPP.Data.dll(大写IPP)中。其他组件正确加载,并且在描述中没有这样的东西。可能导致此错误?我怎么编辑这个? 异常消息:

System.IO.FileNotFoundException: Could not load file or assembly 'Intuit.Ipp.Data' or one of its dependencies. The system cannot find the file specified.

=== Pre-bind state information === LOG: DisplayName = Intuit.Ipp.Data (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: Intuit.Ipp.Data | Domain ID: 1 WRN: A partial bind occurs when only part of the assembly display name is provided. WRN: This might result in the binder loading an incorrect assembly. WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. Newtonsoft.Json也没有加载。其他组件 - 好的。

1 个答案:

答案 0 :(得分:1)

异常类型System.IO.FileNotFoundException表明加载问题发生在客户端代码中。有一行使用例如显式加载此DLL。 Assembly.LoadFile。在这种情况下,合并后可能会出现问题,因为不再有单独的Ipp.Data程序集。

解决方案1:不要合并Ipp.Data程序集

解决方案2:查找导致麻烦的行 - 例如单击应用程序崩溃时调试,或附加到进程 - 然后在合并重新编译程序集加载Ipp.Data修复程序集名称之前。这可以通过使用ildasmilasm实用程序来完成。这里的教程 - http://www.power-programming.co.uk/post/2009/09/23/Using-ildasm-and-ilasm-to-modify-a-NET-assembly.aspx