如何将多个程序集合并为一个? [英] How to merge multiple assemblies into one?

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

问题描述

我使用 EXE 项目(azure 应用程序的启动任务)使用我的服务堆栈,因为我复制了以下服务堆栈的 DLL &一些 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 捆绑在一起,因为要在任何机器上运行我的 EXE,我需要手动复制所有服务堆栈的 DLL.

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?

推荐答案

您有几个选择:

  • 使用一些工具,如SmartAssembly(商业)
    它可以嵌入和合并其他内容(无需更改源代码)

  • 自己编写代码不到 10 行(免费但源代码更改最少)
    将所有需要的依赖项标记为嵌入式资源"——这样它们就包含在 EXE 文件中......你需要设置一个 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天全站免登陆