Здравствуйте, infused, Вы писали:
I>Если использовать ildasm, то в полученном .il файле всегда есть такой участок:
I>.assembly extern mscorlib
I>{
I> .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
I> .ver 1:0:3300:0
I>}
I>.assembly con1
I>{
I> .custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 00 00 00 )
..
I> .custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 00 00 00 )
I> .hash algorithm 0x00008004
I> .ver 1:0:1368:19310
I>}
I>Так вот, для чего нужен .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) ???
An assembly reference can store either a full public key or an 8 byte "publickeytoken." Either can be used to validate that the same private key used to sign the assembly at compile time signed the assembly used at runtime. Neither is required to be present, and while both can be stored this is not useful.
A conforming implementation of the CLI need not perform this validation, but it is permitted to do so, and it may refuse to load an assembly for which the validation fails. A conforming implementation of the CLI may also refuse to permit access to an assembly unless the assembly reference contains either the public key or the public key token. A conforming implementation of the CLI shall make the same access decision independent of whether a public key or a token is used.
I>Если его менять как и н что это влияет?
Если его поменять то может не скомпилится код, или если скомпилится то в рантайме выдаст ошибку
о невозможности загрузить сборку.
I>Зачем нужен ctor и вообще зачем ( 01 00 00 00 00 ) ???
.ctor — это конструктор
( 01 00 00 00 00 ) — это его параметры
Здесь 01 00 — это прагма (магическое число)
а 00 00 00 — это значение параметров
Для лучшего понимания посмотри
\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Tool Developers Guide\docs\Partition II Metadata.doc
... << RSDN@Home 1.1 beta 1 Peru Music — Aguas claras>>