[Mono-devel-list] Reflection[.Emit] / Copy an Assembly

Paolo Molaro lupus at ximian.com
Tue Apr 29 05:19:07 EDT 2003

On 04/29/03 Adam Chester wrote:
> Background:
> I need to create a copy of a dynamic assembly (one created in memory),
> however the copy must be modifiable first. That is, I need to add
> properties and members and attributes to any System.Type in the newly
> created copy of the original assembly. Then using Reflection.Emit (or
> another API such as CodeDom+Compile) to create the new improved
> assembly, which does not need to be saved to disk (but could be if
> necessary).
> Problem:
> So, after various failed attempts at doing this, the only small problem
> left now is that I need a way of copying the dynamic assembly's
> metadata, in particular I am concerned about Custom Attributes. I would
> need to get the attribute instantiation information, rather than the
> more easily obtainable (from Reflection) instance of the custom
> attribute.

There is no Reflection API to do that. You could use the embedding API
to get the info, or you can handle by hand the custom attributes you
need to deal (if they are not arbitrary attributes).


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list