标签: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