mercredi 28 janvier 2015

Assembly.Load 3 dlls


Vote count:

0




I have 3 dlls loaded to resourses. They are switched as Embedded resources. I have such code which loads only one dll to Assembly. How to load all dlls?



public partial class Main : Form
{
public Main()
{
AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
InitializeComponent();

}

public static Assembly AssemblyResolve(object sender, ResolveEventArgs args)
{
Assembly assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream(assembly.GetManifestResourceNames()[3]))
{
if (stream == null)
return null;

byte[] rawAssembly = new byte[stream.Length];
stream.Read(rawAssembly, 0, (int)stream.Length);
return Assembly.Load(rawAssembly);
}
}


asked 12 secs ago







Assembly.Load 3 dlls

Aucun commentaire:

Enregistrer un commentaire