I am confused with load assembly in AppDomain

P

Pab

Hello,

I am confused with load assembly in AppDomain. I created ASP Web
application, same business logic is realized in custom DLLs, and I need to
load ones in my application. If I use ‘Load(assmblyRef)’ method of AppDomain
class, assembly is loaded but DLL file locked. I try to read DLL in byte[]
array and load assembly calling Load(byte[]) method. All are pretty, but in
contrast to calling Load(assmblyRef)’ method, calling Load(byte[]) method
results in assembly is loaded in domain each time (GetAssymles() method
brings assembly array which contains same versions of loading assembly). Can
anybody suggest approach how I can load custom dlls in application not
blocking DLL file.
 
P

Pab

Hi,
Seems it managed code one looks like:
protected Assembly CreateAssembly(string filename)
{
System.IO.FileStream fs = new System.IO.FileStream(filename,
System.IO.FileMode.Open);
byte[] buffer = new byte[(int)fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Assembly asm = this.AppDomain.Load(buffer);
return asm;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top