How to load an assembly without using Assembly.Load?

Can this be done by sending the assembly to memory? If so, how to do it?

Cause:

I do not want to block the loaded DLL. I want to be able to dynamically load, change code, compile and reload it again

+5
source share
4 answers

This can be done by overloading the Load using the byte array. You need to read the assembly bytes before downloading and not lock the file:

byte[] readAllBytes = File.ReadAllBytes("path");
Assembly assembly = Assembly.Load(readAllBytes);
+11
source

As I understand it, you want to do the following:

  • Load the assembly from disk to memory to use data or a call code in it
  • Be able to unload the assembly later
  • , ( ).

, , , , dll .

-, , , . , .

Google, .

-, , , . , , , . .

Assembly.Load, , , .

, A.dll B.dll, A.dll Assembly.Load, ( , , "" ), , B.dll , A.dll, A.dll B.dll .


.

, AppDomain .NET, . , .

, .

. 1, , , , 2, ( ).

, . MarshalByRefObject, , .

, . , . MarshalByRefObject. , -, , , . .

, , , .

, , . , , , .

, - , . - , , , ( ), , , , .

, , , , .

, . , , , , , , MarshalByRefObject, , . - - , MarshalByRefObject, . .

, , , Google, .

+18

Assembly.Load. / , .

+3

DLL , , :

1) , , DLL.

2) .

3) .

+1

All Articles