1

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?

Community
  • 1
  • 1
Jonathan
  • 6,939
  • 4
  • 44
  • 61
  • This is just blind guessing when you don't show us the command line you used. My crystal ball puts a buck on you forgetting to use the /resource option to include the .res file. Required. – Hans Passant May 17 '15 at 12:53
  • @Hans Passant: You crystall ball, sire, shows much truth, but alas some is still hidden. I now get 4096 byte out of 4608. My commandlines: `ildasm MyBinaryLib.dll /output=MyBinaryLib.asm /all /caverbal`, `ilasm /nologo /dll MyBinaryLib.asm /resource=MyBinaryLib.res /output=MyBinaryLib.dll` – Jonathan May 17 '15 at 13:18
  • (original post edited to reflect new findings) – Jonathan May 17 '15 at 13:50

0 Answers0