既にコンパイルされたアセンブリの属性を変更したい (将来、ソースを 2 回コンパイルできるようになるかもしれませんが、現時点ではできません...)。この回答ildasm
は、 を使用し、テキスト ファイル内のプロパティを変更してから、 を使用して再アセンブルすることを示唆していますilasm
。Ildasm および Ilasm を使用してサード パーティ ライブラリに署名するというブログ投稿では、同様の問題に対する同様の解決策が提案されています。
[編集]以下を使用してそれを行いました:
ildasm MyBinaryLib.dll /output=MyBinaryLib.asm /all /caverbal
// no munging for now...
ilasm /nologo /dll MyBinaryLib.asm /resource=MyBinaryLib.res /output=MyBinaryLib2.dll
それは機能しましたが、結果のアセンブリにはいくつかのものが欠けているようです.4608バイトではなく4096バイトです.DLL内のいくつかのテキストブロックを比較したところ、次のものが欠けているようです:
AssemblyCultureAttribute
- 元の assemblyinfo.cs には がありますが[assembly: AssemblyCulture("")]
、ildasm はそれを無視していると思います。AssemblyVersionAttribute
-私は ILSpyを使用して AssemblyVersion を見ているので、これは奇妙です。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 )
私の質問: これらのものが欠けていると、どのような影響がありますか?