简体   繁体   English

在C#中合并外部dll和类库dll

[英]Merge external dlls and class library dll in C#

I have implemented dll using class library c# with externel dlls like Desharp.dll , Newtonsoft.Json.dll , System.Net.Http.Formatting.dll . 我已经使用类库c#和外部dll(例如Desharp.dllNewtonsoft.Json.dllSystem.Net.Http.Formatting.dll实现了dll。 I want single dll of above all dll merge because when i need use my dll no need to add that externel dlls. 我希望以上所有dll的单个dll合并,因为当我需要使用我的dll时,无需添加该外部dll。

=>below link i have saved my required dlls of releced my class library project c# https://files.fm/u/bccxanhz =>下面的链接我已经保存了我的类库项目C# https: //files.fm/u/bccxanhz所需的dll版本

In this blogpost three methods to achieve this are described: http://www.manuelmeyer.net/2016/01/net-power-tip-10-merging-assemblies/ 在此博客文章中,描述了实现此目的的三种方法: http : //www.manuelmeyer.net/2016/01/net-power-tip-10-merging-assemblies/

They fall into two categories: 它们分为两类:

  1. Merge all assemblies into one. 将所有程序集合并为一个。 For this, the tool ILMerge is available. 为此,可以使用工具ILMerge。

  2. Include the external assemblies as resources (build action "Embedded Reosurce") in your assembly and handle the AppDomain.AssemblyResolve event to load the requested assembly from the resource (using Assembly.GetManifestResourceStream() ). 在程序集中将外部程序集作为资源(构建动作“ Embedded Reosurce”)包括在内,并处理AppDomain.AssemblyResolve事件,以从资源加载请求的程序集(使用Assembly.GetManifestResourceStream() )。

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

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