Click to See Complete Forum and Search --> : dotnet assemblies


laasunde
February 21st, 2008, 04:28 AM
Recently I started looking into visual studio utilties such as dumpbin.exe and ildasm.exe to get a better understanding of assemblies in dotnet. A few questions came up and I'd appreciate some input.


// The executable is developed using vs 2005.
// dumpbin /all exename (copied only clr header section)
clr Header:

48 cb
2.05 runtime version
19930 [ F6E4] RVA [size] of MetaData Directory
1 flags
60000BC entry point token
CDB0 [ CB80] RVA [size] of Resources Directory
0 [ 0] RVA [size] of StrongNameSignature Directory
0 [ 0] RVA [size] of CodeManagerTable Directory
0 [ 0] RVA [size] of VTableFixups Directory
0 [ 0] RVA [size] of ExportAddressTableJumps Directory
0 [ 0] RVA [size] of ManagedNativeHeader Directory

// The executable is developed using vs 2002.
// dumpbin /all exename (copied only clr header section)

clr Header:

48 cb
2.00 runtime version
BC14 [ B82C] RVA [size] of MetaData Directory
1 flags
6000004 entry point token
A358 [ 18BC] RVA [size] of Resources Directory
0 [ 0] RVA [size] of StrongNameSignature Directory
0 [ 0] RVA [size] of CodeManagerTable Directory
0 [ 0] RVA [size] of VTableFixups Directory
0 [ 0] RVA [size] of ExportAddressTableJumps Directory
0 [ 0] RVA [size] of ManagedNativeHeader Directory


The following 1.0.3705, 1.1.4322, 2.0.50727 .NET versions are installed on my computer.

1. Why does the CLR header operate with runtime version 2.00 and 2.05? I would expect the application built with vs2002 to use .NET 1.1 and the project built with vs2005 to use .NET version 2.0. The above information does not make sence to me.

2. Does mscoree.dll use the runtime version info in the clr header to determine which clr to use?



// The executable is developed using vs 2005.
// ildasm exefile (copied only first section of manifest)
// Metadata version: v2.0.50727

.module extern user32.dll
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly extern System.Drawing
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 2:0:0:0
}
.assembly extern System.Windows.Forms
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}


3. In the above output all .NET assemblies ref to verion 2.0.0.0. None of these files exist on my computer with version 2.0.0.0. They all use 2.0.50727. How does this work?

boudino
February 21st, 2008, 09:35 AM
Ad 1. I think it is version of the header, not of the framework.

Ad 2. I don't know, sorry.

Ad 3. 2.0.0.0 is the assembly version, which is used to resolve the assembly. 2.0.50727 is file version. It is one of many metainformation in the assembly. See the sample; it is emphasised in it.

// Metadata version: v2.0.50727
.module extern kernel32.dll
.module extern advapi32.dll
.module extern ole32.dll
.module extern oleaut32.dll
.module extern odbc32.dll
.module extern System.Data.dll
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.hash = (C8 B8 E8 A0 CC 5F 69 1E EA 1F B7 29 90 C1 14 7F // ....._i....)....
07 AA 0E CC )
.ver 2:0:0:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.hash = (C3 FF E2 E4 9D 6E E3 B4 3B AF 6C 92 5B 14 BD A3 // .....n..;.l.[...
1A 33 E4 E5 ) // .3..
.ver 2:0:0:0
}
.assembly extern Microsoft.VisualC
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.hash = (02 EF C7 50 8D D1 75 7C 08 11 30 9A DA 13 32 41 // ...P..u|..0...2A
59 73 A8 0F ) // Ys..
.ver 8:0:0:0
}
.assembly extern System.Xml
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly extern System.Transactions
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly extern System.EnterpriseServices
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 2:0:0:0
}
.assembly extern System.Configuration
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
.ver 2:0:0:0
}
.assembly System.Data
{
.custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 2F C2 A9 20 4D 69 63 72 6F 73 6F 66 74 20 // ../.. Microsoft
43 6F 72 70 6F 72 61 74 69 6F 6E 2E 20 20 41 6C // Corporation. Al
6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 // l rights reserve
64 2E 00 00 ) // d...
.custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
.custom instance void [mscorlib]System.Security.AllowPartiallyTrustedCallersAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 1A 4D 69 63 72 6F 73 6F 66 74 C2 AE 20 2E // ...Microsoft.. .
4E 45 54 20 46 72 61 6D 65 77 6F 72 6B 00 00 ) // NET Framework..
.custom instance void [mscorlib]System.Reflection.AssemblyInformationalVersionAttribute::.ctor(string) = ( 01 00 0E 32 2E 30 2E 35 30 37 32 37 2E 31 34 33 // ...2.0.50727.143
33 00 00 ) // 3..
.custom instance void [mscorlib]System.Resources.SatelliteContractVersionAttribute::.ctor(string) = ( 01 00 07 32 2E 30 2E 30 2E 30 00 00 ) // ...2.0.0.0..
.custom instance void [mscorlib]System.Resources.NeutralResourcesLanguageAttribute::.ctor(string) = ( 01 00 05 65 6E 2D 55 53 00 00 ) // ...en-US..
.custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 0F 53 79 73 74 65 6D 2E 44 61 74 61 2E 64 // ...System.Data.d
6C 6C 00 00 ) // ll..
.custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 0E 32 2E 30 2E 35 30 37 32 37 2E 31 34 33 // ...2.0.50727.143
33 00 00 ) // 3..

laasunde
February 21st, 2008, 02:10 PM
Thanks for your reply.

1. Ok, will do some more research given that context. Do you think there is any correlation between clr header version and .NET version?

3. Of course.

4. Do you know if all .NET assemblies contains information regarding which .NET version they are built with and therefore know which versions they are compatible with?