[Mono-dev] Setting Assembly's Attributes / Injecting new attributes

Weston Weems wweems at gmail.com
Fri Feb 16 17:18:45 EST 2007


Today I happened upon Mono.Cecil libraries and I've got to say, quite
mindblowing. I've found something that lookes to be something Cecil
should fairly easily be able to do, however I cant seem to deduce it
from the documentation or lack thereof.

I've been able to open an assembly with the following

AssemblyDefinition sourceAssembly =
AssemblyFactory.GetAssembly("MyAssembly.exe");

Which works and I can loop through the .CustomAttributes etc, but I
cannot seem to figure out on my own how I can overwrite an existing
attribute value, or how to inject a new custom attribute all together.

I was wondering if somone had a VERY simple example, that perhaps just
changed "AssemblyNameAttribute" to hellow world or something.

I'd be greatly appreciative as my searching in news groups and such
has kinda come to a dead end.

Thanks in advance.
Weston



More information about the Mono-devel-list mailing list