首页 > 其他 > 详细

Compile DLLs referenced into exe/dll

时间:2018-05-08 10:04:33      阅读:296      评论:0      收藏:0      [点我收藏+]

 

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!