如何将多个组件合并成一个? [英] How to merge multiple assemblies into one?

查看:353
本文介绍了如何将多个组件合并成一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用消耗在我抄以下服务栈的DLL和EXE功放项目(为Azure应用程序启动任务),我的服务栈;一些天青的DLL文件到EXE项目。

I consuming my service stack using EXE project (startup task for azure application) in that I have copied following service stack's DLL & some Azure's DLLs in to EXE project.

当我建立这个EXE项目,然后Azure中的DLL将与我的EXE,但服务栈的DLL不会与EXE捆绑捆绑在一起的,因为运行我的任何机器,我需要手动复制所有的服务协议栈的DLL的EXE文件。

When I build this EXE project then Azure DLLs will be bundled with my EXE but service stack's DLL will not be bundled with EXE, because to run my EXE on any machine I need to copy all service stack's DLL manually.

我已经使用这个服务栈的DLL使用

I have used this service stack's dll to use

JsonServiceClient client = new JsonServiceClient(servicepath);

我应该做捆绑所有这些DLL文件在我的EXE?

What should I have to do to bundled all these DLLs in to my EXE?

推荐答案

您有几种选择:

  • use ILMerge (free)
    For howto see here and here


  • 使用如 SmartAssembly (商业)一些工具

    它可以嵌入和除其他外合并(无需更改源$ C ​​$ C)

  • use some tool like SmartAssembly (commercial)
    it can embed and merge among other things (no need to change your source code)


  • $c$c那你自己在不到10行(免费的,但最小的源$ C ​​$ c修改)

    标记所有需要的依赖关系为嵌入的资源 - 这种方式,他们都包含在EXE文件......你需要设置一个<一个href=\"http://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve.aspx\"><$c$c>AssemblyResolve该处理器在运行时从资源读取并返回所需的DLL到.NET运行时...

  • code that yourself in less than 10 lines (free but minimal source code change)
    mark all needed dependencies as "embedded resource" - this way they are included in the EXE file... you need to setup an AssemblyResolve handler which at runtime reads from Resources and returns the needed DLLs to the .NET runtime...

这篇关于如何将多个组件合并成一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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