views:

73

answers:

1

Is this even possible? For example, I would like to read the assembly as a stream of bytes from the network or from a zip archive and run it from RAM itself without having to create an image on the disk.

+8  A: 

Assembly.Load(Byte[])

Franci Penov
A production application that uses that is Microsoft CRM Outlook client. You can register dll's as plug ins, and depending on your settings, it will only ever live in the clients database as binary stream, and get executed directly, without creating a file. It works surprisingly well
Rihan Meij
Another use for this: you can compile-in assemblies as embedded resources, and load them from GetManifestResourceStream. The effect is sort of like ILMerge, but it is done at an application level. You can also dynamically compile (CodeDom) assemblies and use them this way.
Cheeso