C#编译器生成的.exe文件是否仅由通用中间语言(CIL)组成?

我只是想更好地掌握以下代码添加文件并使用.cs扩展名保存时在简单场景中发生的事情:
public class HelloWorld
{
  public static void Main()
  {
    System.Console.WriteLine("Hello World!");
    System.Console.ReadLine();
  }
}

然后这个程序在windows命令行运行:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>csc /t:exe /out:C:\HelloWorld\HelloWorld.exe C:\HelloWorld\HelloWorld.cs

我可以看到这个进程生成一个.exe文件,但是在阅读有关compile process on wikipedia时,它指出:

  1. Source code is converted to Common Intermediate Language (CIL),which is the CLI’s equivalent to Assembly language for a cpu.
  2. CIL is then assembled into a form of so-called bytecode and a CLI assembly is created.
  3. Upon execution of a CLI assembly,its code is passed through the runtime’s JIT compiler to generate native code…
  4. The native code is executed by the computer’s processor.

那么.exe文件本身只包含Common Intermediate Lanaguage吗?这个文件本身就是维基百科文章所称的’CLI程序集’吗?我有点困惑,因为我只能看到.exe文件,对我来说,’assembly’这个术语推断出多个文件.

相关问题:

>是Microsoft.NET目录中的JIT编译器,在执行.exe文件时,文件与JIT编译器通信,然后JIT编译器以本机代码输出指令?

解决方法

不,它没有.

可执行文件PE image.

有关详情,请参阅Anatomy of a .NET Assembly – PE Headers.

.NET assemblies are built on top of the PE (Portable Executable) file format that is used for all Windows executables and dlls,which itself is built on top of the MSDOS executable file format. The reason for this is that when .NET 1 was released,it wasn’t a built-in part of the operating system like it is Nowadays. Prior to Windows XP,.NET executables had to load like any other executable,had to execute native code to start the CLR to read & execute the rest of the file.

相关文章

在要实现单例模式的类当中添加如下代码:实例化的时候:frmC...
1、如果制作圆角窗体,窗体先继承DOTNETBAR的:public parti...
根据网上资料,自己很粗略的实现了一个winform搜索提示,但是...
近期在做DSOFramer这个控件,打算自己弄一个自定义控件来封装...
今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都...
最近在研究WinWordControl这个控件,因为上级要求在系统里,...