.Net Assembly初接触

类别:.NET开发 点击:0 评论:0 推荐:

简单的一段代码:
//main.cs

using System;

class MyMainClass
{
    public static void Main()
    {
        Console.WriteLine("Main program!");
    }
}
编译成main.exe后用ildasm.exe反编译了一下,生成如下的manifest:
// Metadata version: v2.0.40607
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 2:0:3600:0
}
.assembly main
{
  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )
  .hash algorithm 0x00008004
  .ver 0:0:0:0
}
.module main.exe
// MVID: {D8F028FF-4E4B-46B6-8E5C-A7245623C097}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x043B0000

红色部分的估计就是assembly manifest了。

本文地址:http://com.8s8s.com/it/it43672.htm