Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
803 views
in Technique[技术] by (71.8m points)

c# - ILMerge DLL: Assembly not merged in correctly, still listed as an external reference

In the build process for a .NET C# tool, I have been using ILMerge to merge the assemblies into a single exe.

I added a new class library recently, and now the ILMerge is failing. I have remembered to tell it to merge in the new DLL!

It is now giving me this error, which I don't really understand:

ILMerge.Merge: The assembly 'DataObjects' was not merged in correctly. It is still listed as an external reference in the target assembly.

All of the assembly references I have done using 'project' references, and it has not failed in the past.

Can anyone explain this error for me, or suggest a workaround please?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had to use the /closed argument. According to the official docs:

Closed

When this is set before calling Merge, then the "transitive closure" of the input assemblies is computed and added to the list of input assemblies. An assembly is considered part of the transitive closure if it is referenced, either directly or indirectly, from one of the originally specified input assemblies and it has an external reference to one of the input assemblies, or one of the assemblies that has such a reference. Complicated, but that is life...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...