使用 ILMerge 合并 .NET EXE 后仍尝试查找 DLL
我正在尝试使用 ILMerge 工具进行简单合并,以将 DLL 与可执行文件组合在一起。合并本身工作正常,但在我运行合并的 EXE 后,它仍然尝试查找原始 DLL(就像它根本没有合并到 EXE 中一样)。
ILMerge 是否会自动更新对内部的引用,还是我必须手动执行某些操作?我假设 ILMerge 会自动完成所有操作。
EXE 和 DLL 都是 WinForms .NET 3.5。
I'm trying simple merging using ILMerge tool to combine a DLL with the executable. The merging itself works fine, but after I run the merged EXE, it still attempts to find the original DLL (like if it wasn't merged into the EXE at all).
Does ILMerge update references to internal automatically or I have to do something manually? I was under assumption that ILMerge makes everything automatically.
Both EXE and DLL are WinForms .NET 3.5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
ILMerge 自动执行多项操作...
但 ILMerge 实际上修改了 DLL + EXE 的内部结构...
并非所有 DLL 等都“喜欢”以这种方式“混乱”...
例如,当 EXE 和/或 DLL 使用反射或 WPF 合并时可以让它们失败...
在这些情况下,“嵌入”(而不是合并)效果最好...尽管您必须编写大约 10 行代码 - 请参阅 http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx< /a>
如果你只是想要一个工具来实现这一点(以及其他一些事情),那么有一些工具 - 例如 SmartAssembly...
但请注意:以上任何工具都仅适用于 .NET DLL - 不适用于与本土人...
ILMerge makes several things automatically...
But ILMerge actually modifies the internal structure of both DLL + EXE...
Not all DLLs etc. "like" being "messed with" this way...
For example when EXE and/or DLL use Reflection or WPF merging could make them fail...
In these situations "embedding" (instead of merging) works best... though you will have to write someabout 10 lines of code - see http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx
IF you just want a tool to make that (and some other things) happen there are some out there - for example SmartAssembly...
Note however: Any of the above works only with .NET DLL - not with native ones...
该问题是由其他尝试使用原始程序集的非合并 DLL 引起的。我也必须合并它们,现在一切正常。
The issue was caused by other non-merged DLLs that try to use the original assembly. I had to merge them as well and now everything works correctly.
有问题的 DLL 之一是否有可能尝试重新打开自身?
Is it possible that one of the DLLs in question attempts to re-open itself?