简体   繁体   English

将Dll合并到汇编或嵌入资源 - 哪个更好?

[英]Merge Dll to Assembly or Embed in Resource - which is Better?

Should I merge the referenced Dlls into the assembly using ILMerge or embed the Dll into the Resource of the Main Assembly and Load at Run-time. 我应该使用ILMerge将引用的Dll合并到程序集中,还是将Dll嵌入到主程序集的资源中并在运行时加载。

Which would be better in terms of performance.In both cases the Final Executable will be compressed and unpacked at run-time. 在性能方面哪个更好。在这两种情况下,最终可执行文件将在运行时压缩和解压缩。

Personally, I would not embed the dll in the assembly. 就个人而言,我不会将dll嵌入程序集中。 This creates an executable assembly that is hard to work with without recompilation and is bulky. 这将创建一个可执行的程序集,无需重新编译即可使用,并且体积庞大。 It is much better to reference the dlls locally, and that speeds up the program. 最好在本地引用dll,这样可以加快程序的运行速度。

This is .NET. 这是.NET。 The "executables" are still just bytecode anyway and the actual native code is hidden away in a temporary folder after the runtime JITs it. 无论如何,“可执行文件”仍然只是字节码,并且在运行时JIT之后,实际的本机代码被隐藏在临时文件夹中。 I doubt you'll gain any noticeable difference from either of the two proposed methods over the other. 我怀疑你会从两种提议的方法中获得任何明显的差异。

Distributing separate DLLs is nice when you want to make changes to the application, since you're only replacing components, rather than the entire assembly. 当您想要更改应用程序时,分发单独的DLL是很好的,因为您只是替换组件而不是整个程序集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM