码迷,mamicode.com
首页 > 其他好文 > 详细

Compile DLLs referenced into exe/dll

时间:2018-05-08 10:23:09      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:dll   lib   null   rgs   length   static   .dll   action   sys   

 

1:

DLLs  build action: Embedded Resource

 

2:

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;  

 

static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
return LoadFromResource("LitJson.dll");
}

private static Assembly LoadFromResource(string resName)
{
Assembly ass = Assembly.GetExecutingAssembly();
using (Stream stream = ass.GetManifestResourceStream(".....Common.Lib." + resName))
{
byte[] bt = new byte[stream.Length];
stream.Read(bt, 0, bt.Length);
Assembly asm = Assembly.Load(bt);
return asm;
}
return null;
}

Compile DLLs referenced into exe/dll

标签:dll   lib   null   rgs   length   static   .dll   action   sys   

原文地址:https://www.cnblogs.com/pcchs/p/9006621.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!