Assembly serialization

  • Thread starter Thread starter V&G
  • Start date Start date
V

V&G

There is many topics about the subj but no one answering the
question...
Is there any way to serialize an assembly?
The case of reading from disk as stream seems like bad solution because
there are problems to process such assembly (see
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_frm/thread/6dff95d4ea9b6671)
No, I'm looking for the way to serialize an assembly as we generaly
serialize other serializable objects. In case of assembly after
serialization I get only the buffer with metadata...
Here is code example:

Byte[] buf;
Assembly asm = Assembly.LoadFrom(path);
using (MemoryStream ms = new MemoryStream())
{
BinaryFormatter format = new BinaryFormatter();
format.Serialize(ms, asm);
buf = ms.ToArray();
}
 
Assemblies are a means of packaging classes (blueprints). If you look at the
..NET Framework BCL, you will see that there are often disparate classes and
namespaces in a single assembly, because it made sense to package them in
that way.

Serialization is a means of getting information from place to place. An
assembly is a deployable set of classes and class libraries, not information.

Can you create something to recreate all of the classes from an assembly on
another box that does not have a copy of the assembly? If this is your
question, the answer is "sure", but why not simply copy the executable. If
you need to get it from one place to another and cannot use "normal" methods
(copy and paste, for example), you can certainly stream the bits and bytes,
but that is still not "serialization".

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top