我正在使用ILMerge版本2.11.1103.0將4個DLL合併到一個新程序集中。假設他們被稱爲A,B,C,和d,它們的關係如下:ILMerge程序集未正確合併
B -> A
C -> A
D -> A
D -> C
當我在A,B和C運行ILMerge,這一切工作完全正常。然而,當我加入DI收到以下錯誤:
An exception occurred during merging:
ILMerge.Merge: The assembly 'A' was not merged in correctly.
It is still listed as an external reference in the target assembly.
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
我一直在使用如下所示ILMerge DLL: Assembly not merged in correctly, still listed as an external reference的/關閉的選項嘗試,但遺憾的是它並沒有幫助:
In order to close the target assembly, the number of assemblies to be added to the input is 0.
當我改變的順序組件,我收到以下異常:
An exception occurred during merging:
Index was outside the bounds of the array.
at System.Compiler.ISymUnmanagedWriter.CloseMethod()
at System.Compiler.Ir2md.VisitMethodBody(Method method)
at System.Compiler.Ir2md.VisitMethod(Method method)
at System.Compiler.Ir2md.Visit(Node node)
at System.Compiler.Ir2md.VisitClass(Class Class)
at System.Compiler.Ir2md.Visit(Node node)
at System.Compiler.Ir2md.VisitModule(Module module)
at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation)
at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer)
at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName)
at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module)
at System.Compiler.Module.WriteModule(String location, CompilerParameters options)
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
我使用的完整命令行是:
ILMerge.exe /targetplatform:v4,"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" /log:ilmerge.log /target:library /union /xmldocs /copyattrs /allowMultiple /internalize /closed /keyfile:keyfile.snk /out:Merged.dll A B C D
任何人都可以看到我做錯了什麼?謝謝。
將連接到電子郵件的程序集發送給Microsoft Research的Mike Barnett。他過去一直很有迴應,所以你會有一些可能會聽到的聲音。他的電子郵件地址位於此頁面上:http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx – 2012-08-02 21:23:09
太棒了,謝謝。會試一試。 – Mightymuke 2012-08-02 22:15:36
對我而言,這個錯誤是非破壞性的。合併的DLL通過所有單元測試並檢查程序集顯示一切都在那裏。所以不確定哪些元素「沒有正確合併」。 – 2015-12-22 15:59:36