了解IlMerge - 如何打包可执行所有它相关的DLL [英] Understanding IlMerge - how to pack an executable with all it's associated dll's

查看:220
本文介绍了了解IlMerge - 如何打包可执行所有它相关的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我不是问对堆栈溢出这个问题的第一人,我相信我不会是最后一次。但是,花时间研究如何做到这一点,然后身体试图做到这一点后,我靠近准备放弃了。

I know I'm not the first person to ask this question on Stack Overflow and I'm sure I won't be the last. But, after spending hours researching how to do this and then physically trying to do it, I'm near ready to give up.

我有一个.NET Framework 4中,C#,WinForms应用程序是建立一个可执行文件。我靠很多很多很多的DLL。该dll文件分为多个类别。

I have a .NET Framework 4, C#, WinForms application that builds to an executable. I rely on many many many dlls. The dlls fall into multiple categories.

  • 在图书馆我已经写了,没有依赖自己的
  • 在图书馆我已经写了与其他库的依赖我已经写了
  • 在图书馆我已经写了与第三方的dll的依赖
  • 在第三方独立的DLL
  • 在第三方的dll用自己的依赖于其他DLL

所以,当我编译我的应用程序有一个可执行文件的目录中,约15 dll文件。

So after I compile my application I have a directory with an executable and approximately 15 dlls.

我要收拾所有的DLL到一个可执行,这样我可以简单地分配一个单独的可执行文件。

I want to pack all the dlls into a single executable so that I can simply distribute a single executable.

我知道IlMerge是一般建议应用程序使用这一点,但我很好奇,如果有什么更容易使用更直观和作品进行的跨两个WinForms和WPF。

I know that IlMerge is the typically suggested application to use for this, but I'm curious if there is something easier to use that is more intuitive and works accross both WinForms and WPF.

推荐答案

在年底,我去了一个完全不同的方向。

In the end, I went an entirely different direction.

我决定使用 Costura的Visual Studio位于此处。

这些扩展使用两种方法的组合

These extensions use a combination of two methods

  • Jeffrey Richter's suggestion of using embedded resources as a method of merging assemblies
  • Einar Egilsson's suggestion using cecil to create module initializers

什么是好的是,你只需将扩展安装到Visual Studio中。这样做,因为你要收拾你的DLL到一个可执行的任何项目,只需选择该项目后,单击菜单栏,Costura,配置,再确定上项目。它会问你要重新加载项目 - 单击是。现在,只要你建立的项目将只创建一个可执行文件(或DLL,如果你正在做一个库)。不能更容易。

What's nice here is that you simply install the extensions into Visual Studio. After doing that, for any project where you want to pack your DLLs into a single executable, simply select the project, click Project on the menu bar, Costura, Configure, and then OK. It will ask you to reload the project - click yes. Now whenever you build the project it will create just a single executable (or DLL if you are doing it on a library). Couldn't be more easy.

这篇关于了解IlMerge - 如何打包可执行所有它相关的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆