Prionum
Prionum

Reputation: 143

AppDomain.Load (Assembly from memory)

I am trying to load an assembly into an AppDomain in memory from a byte array. Basically, I have a system in which code assemblies are transmitted, and I need to isolate each assembly in its own AppDomain, from which I can initialize an instance.

However, I am struggling to load the assembly itself into the AppDomain; the only way is by having a file, but I am wondering if there is a way to do so without it.

Image

For me, it would be very convenient to do it by just using the raw assembly bytes.

Thanks in advance ^:)

Upvotes: 0

Views: 656

Answers (1)

Visual Vincent
Visual Vincent

Reputation: 18310

According to the MSDN Documentation for AppDomain.Load() one of the overloads takes a byte array to load an assembly, so I don't really see your problem here.

Here's an example where an assembly has been loaded into My.Resources as a byte array:

Dim TargetAssembly As Reflection.Assembly = System.AppDomain.CurrentDomain.Load(My.Resources.MyAssembly)

Upvotes: 1

Related Questions