我如何强制使用 exe 构建 DLL,以便只有一个文件?
我有一个简单的 C# 应用程序。我希望 DLL 位于 exe 文件“内部”。我该怎么做?
i have a simple app in c#. i would like the DLL to be "inside" the exe file. how do i do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ILMerge正是您正在寻找的
页面有点误导,ILMerge 根据其 实际网页
要回答如何使用其他答案中的问题中的它
因此
ilmerge /out:Combined.exe mainFile.exe otherDll.dll
适合您的情况,因为大多数默认值应该没问题ILMerge does exactly what you are looking for
the page is a little misleading, ILMerge works on V3 and V4 assemblies per its actual webpage
To answer how do you use it from your question in the other answer
So
ilmerge /out:Combined.exe mainFile.exe otherDll.dll
for your case as most of the defaults should be fineILMerge 可以对 .NET 程序集执行此操作 - 尽管它有一些某些类型的程序集(例如 WPF 程序集)的限制。
您也可以将程序集用作资源并按需加载,或使用支持程序集合并的众多商业混淆器之一。许多第三方选项支持更精细的依赖关系合并和/或依赖关系嵌入。 SmartAssembly 就是一个很好的例子,它支持这两个选项。
ILMerge can do this for .NET assemblies - though it has some limitations with certain types of assemblies (such as WPF Assemblies).
You can, alternatively, use the assembly as a resource and load it on demand, or use one of the many commercial obfuscators which support assembly merging. Many of the third party options support more elaborate depedency merging and/or dependency embedding. A good example of this is SmartAssembly, which supports both options.