加载 ILMerged 程序集时出现 FileNotFoundException

FileNotFoundException on loading ILMerged assemblies

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

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(capital 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 也加载不出来。其他组件 - 好的。

异常类型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