I want to change an attribute in an already-compiled assembly (in the future I might be able to compile my sources twice, but not at-the-moment...). This answer suggests that I use ildasm
, munge the properties in the text file and then re-assemble using ilasm
. The blog post Signing a Third Party Library With Ildasm and Ilasm suggests a similar solution for a similar problem.
[edit] I did that, using:
ildasm MyBinaryLib.dll /output=MyBinaryLib.asm /all /caverbal
// no munging for now...
ilasm /nologo /dll MyBinaryLib.asm /resource=MyBinaryLib.res /output=MyBinaryLib2.dll
and it worked, but it seems that the resulting assembly is missing some stuff - it's 4096 bytes instead of 4608. I compared some text blocks inside the DLLs, and it seems that the following are missing:
AssemblyCultureAttribute
- My original assemblyinfo.cs has[assembly: AssemblyCulture("")]
, I guess ildasm ignores that.AssemblyVersionAttribute
- which is weird, since I do see AssemblyVersion using ILSpy.System.Diagnostics, DebuggableAttribute, DebuggingModes
- ILSpy does show a missing[assembly: Debuggable]
attribute. The .asm file also says:
-
// --- The following custom attribute is added automatically, do not uncomment -------
// .custom /*0C00000C:0A00000E*/ instance void [mscorlib/*23000001*/]System.Diagnostics.DebuggableAttribute/*0100000F*/::.ctor(valuetype [mscorlib/*23000001*/]System.Diagnostics.DebuggableAttribute/*0100000F*//DebuggingModes/*01000010*/) /* 0A00000E */
// = {int32(263)}
// // = ( 01 00 07 01 00 00 00 00 )
My question: What are the effect of these things missing?