我想更改已经编译的程序集中的属性(将来我可能可以编译我的源两次,但现在不行......)。这个答案建议我使用ildasm
, 修改文本文件中的属性,然后使用ilasm
. 博客文章Signing a Third Party Library With Ildasm and Ilasm为类似问题提出了类似的解决方案。
[编辑]我这样做了,使用:
ildasm MyBinaryLib.dll /output=MyBinaryLib.asm /all /caverbal
// no munging for now...
ilasm /nologo /dll MyBinaryLib.asm /resource=MyBinaryLib.res /output=MyBinaryLib2.dll
它有效,但似乎生成的程序集缺少一些东西 - 它是 4096 字节而不是 4608。我比较了 DLL 中的一些文本块,似乎缺少以下内容:
AssemblyCultureAttribute
- 我原来的 assemblyinfo.cs 有[assembly: AssemblyCulture("")]
,我猜 ildasm 忽略了这一点。AssemblyVersionAttribute
- 这很奇怪,因为我确实看到 AssemblyVersion 使用 ILSpy。System.Diagnostics, DebuggableAttribute, DebuggingModes
- ILSpy 确实显示了一个缺失的[assembly: Debuggable]
属性。.asm 文件还说:
-
// --- 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 )
我的问题:这些东西丢失的影响是什么?