是否可以仅使用ILMerge合并依赖项的子集? [英] Is it possible to only merge a subset of dependencies using ILMerge?
问题描述
我正在尝试一些探索性的事情:
I'm trying something exploratory:
说我有一个库"coolproject",它具有对 one.dll
, two.dll
和 three.dll
的依赖.
Say I have a library "coolproject" and it has dependencies to one.dll
, two.dll
, and three.dll
.
我想使用ILMerge将coolproject与 one.dll
和 two.dll
组合在一起,而不是 three.dll
.合并完成后,我应该具有 coolproject.dll
和 three.dll
.无论我打算在哪里使用 coolproject.dll
,我都必须引用 three.dll
I would like to use ILMerge to combine coolproject with one.dll
and two.dll
but NOT three.dll
. At the completion of the merge I should have coolproject.dll
and three.dll
. Wherever I intend to use coolproject.dll
I must also reference three.dll
这甚至有可能吗?每当我尝试它,我都会得到.未解决的程序集引用:三
.我通过设置"Copy Local" = false省略了 ree.dll
.
Is this even possible? Whenever I try it I get. Unresolved assembly reference not allowed: three
. I'm omitting three.dll
by setting "Copy Local" = false.
:
执行如下:
ILMerge /targetplatform:v2 /log /internalize /out:bin\coolproject.dll obj\Debug\coolproject.dll C:\Users\Nick\Projects\test\bin\one.dll C:\Users\Nick\Projects\test\bin\two.dll
推荐答案
此方法不起作用的原因很简单:ILMerge必须能够找到列表中省略的dll.
The reason this does not work ended up being rather simple: ILMerge must be able to locate the dll that you have omitted from the list.
在评估目标库中的依赖项时,默认情况下,即使您从命令行列表中省略了依赖库,ILMerge也会检查各个位置以识别依赖库(\ bin,GAC等).如果找不到该库,则必须使用 \ lib
开关指定其位置.否则,您将看到不允许的 Unresolved程序集引用:三
错误.
When evaluating dependencies in the target library, ILMerge by default checks various locations to identify the dependent library (\bin, GAC, etc) even if you omitted it from the command line list. If it cannot locate this library you must specify its location using the \lib
switch. Otherwise you will see the Unresolved assembly reference not allowed: three
error.
示例:
ILMerge /lib:..\three\bin\three.dll /targetplatform:v2 /log /internalize /out:bin\coolproject.dll obj\Debug\coolproject.dll C:\Users\Nick\Projects\test\bin\one.dll C:\Users\Nick\Projects\test\bin\two.dll
这篇关于是否可以仅使用ILMerge合并依赖项的子集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!