3

I'm trying to use ILMerge to internalize some transitively referenced assemblies into an assembly I'm referencing to eliminate conflicts with those transitive dependencies elsehwere in my project.

In particular, I'm referencing Antlr3.StringTemplate (hereafter referred to as AS, available here: http://www.stringtemplate.org/download.html). It references Antlr3.Runtime.Debug (ARD) and Antlr3.Runtime (AR). ARD itself also references AR. In ASCII-art, that's:

AS ---> ARD
\        |
 \       v
  \---> AR

Because another assembly I'm using, NHibernate 2.1, depends on different, incompatible version of AR, I wanted to use ILMerge to merge and internalize AR into AS. In theory, I think this should work; however, I'm having trouble executing the theory.

No matter what permutations and options I try, I end up with an error of the following form:

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

Is what I'm trying to accomplish with ILMerge even possible?

4

3 回答 3

5

当您从命令行(或在 MSBuild 任务中)运行 ILMerge 时,在您列出要合并的所有程序集文件中,它是合并开始时被视为主程序集的第一个文件如果您还没有,请确保 AS 程序集文件名列在合并程序集列表的首位。

于 2009-09-18T00:46:13.367 回答
5

最新版本的 ILMerge 有一个/closed选项可用于合并程序集的传递闭包。它解决了这个确切的问题(参见章节2.6 Closed4.1 Input assembly not merged in correctlyILMerge.doc 用户手册)。

于 2010-09-16T16:59:51.043 回答
0

我最终不得不将所有与 Nhibernate 相关的 .dll 合并为一个,以使其与 StringTemplate 很好地配合。可能不是您希望的答案,但它有效。

于 2010-11-29T10:05:17.343 回答