gpt4 book ai didi

c# - ILMerge 程序集未正确合并

转载 作者:太空狗 更新时间:2023-10-30 01:07:36 25 4
gpt4 key购买 nike

我正在使用 ILMerge 版本 2.11.1103.0 将 4 个 DLL 合并到一个新程序集中。假设分别称为A、B、C、D,则它们之间的关系如下:

B -> A
C -> A
D -> A
D -> C

当我在 A、B 和 C 上运行 ILMerge 时,一切都运行良好。但是,当我添加 D 时,我收到以下错误:

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)

我已尝试使用此处指示的/closed 选项 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

谁能看出我做错了什么?谢谢。

最佳答案

正如@HansPassant 在上面的评论中所建议的那样,我联系了 Microsoft fame 的 Mike Barnett。他能够通过以下方式帮助我解决此问题:

  • 正在从 http://nuget.org/packages/ilmerge 升级到最新版本的 ilmerge (2.12.0803)

  • 从命令中删除/union 开关(之前添加此开关是为了解决在已被代码契约重写器重写的合并程序集上运行 gendarme 的问题。谢天谢地,由于构建过程中的更改,这不是需要更长的时间)。

关于c# - ILMerge 程序集未正确合并,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11771752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com