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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


1:最直白的循环遍历方法,可以分为遍历key--value键值对以及所有的key两种表现形式2:用Linq的方式去查询(当然了这里要添加对应的命名空间 using System.Linq)如下为一个十分简单的代码示例:private void GetDicKeyByValue(){ Dicti...
private void ClearTextBox(){ foreach (var control in pnlDetail.Controls) { if (!(control is TextBox)) continue; var txtBox = (TextBox)control; txtBox.
原文叫看《墨攻》理解IOC概念 2006年多部贺岁大片以让人应接不暇的频率纷至沓来,其中张之亮的《墨攻》算是比较出彩的一部,讲述了战国时期墨家人革离帮助梁 国反抗赵国侵略的个人英雄主义故事,恢宏壮阔,浑雄凝重的历史场面相当震撼。其中有一个场景:当刘德华所饰的墨者革离到达梁国都城 下,城上梁国守军问:
System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
Request.Form value was detected from the client在使用ASP.NET MVC3 开发系统的用了百度的UEditor编辑器提交表单时遇到检测到有潜在危险的 Request.Form,我百度一下,试了网上的方法,都没用。要在Web.config增加<h
右击文件夹->安全选项卡->添加->高级->立即查找Windows Server 2003:请您在目录添加IIS来宾帐号(IUSR_Hostname)的只读权限,以及Network Service组的读写修改权限。Windows Server 2000:请您在目录添加IIS来
<compilationdebug="true"><buildProviders><addextension=".html"type="System.Web.Compilation.PageBuildProvider&q
在ASP.NET MVC 中 Spring.NET 配置注入的时候,下面这方式是可行的。<spring> <context> <resource uri="config://spring/objects" /> </context>
Stopwatch stopwatch = new Stopwatch();stopwatch.Start();。。。。。中间代码。。。	stopwatch.Stop();	long result = stopwatch.ElapsedMilliseconds;sqlBulkCopy.Close()
问题描述 在asp.net mvc 下配置ueditor图片上传时总是提示:缺少十六进制字符错误(IE下提示),起初还以为是我上传的图片名称中有中文字符所致,后来我又上传了英文字符名字的图片发现还是一样的错误提示:◆无赖之下只好到火狐下看错误的详情:◆第二个错误我无法解决,先看第一个,输入地址显示错
已经安装net2.0 和3.5 ,但IIS里面却只有1.1开始→运行→CMDC:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i按回车键后便会开始自动安装,安装完重启一下IIS在IIS中ASP.NET选项卡便可以看到。注
根据传进来不同的值,调用不同的方法View Code protected void btn_SwitchClick(object sender, EventArgs e){ string result = ""; switch (ddlMethod.SelectedValue)
整理两个 在C#中,用正则表达式 获取网页源代码标签的属性或值的方法 :1、获取标签中的值: CSDN 结果:CSDN/// /// 获取字符中指定标签的值 /// /// 字符串 /// 标签 /// 值 public static string GetTitleContent(string st
/// <summary>/// 集合装换DataTable/// </summary>/// <param name="list">集合</param>/// <returns></returns>publ
将目录下面所有的 .cs 文件合并到一个 code.cs 文件中,写著作权复制代码时的必备良药 @echo off echo 将该目录下所有.cs文件的内容合并到一个 code.cs 文件中! pause dir /ad/s/b > folderPath.txt md codeTemp for
做接口开发的时候,往往接受参数或返回值是一个XML的字符串。如下图,不方便辨识 两种方法, 1.将它保存为xxx.xml,然后用浏览器打开。这种方法稍微有些麻烦。 2.使用 UltraEdit 工具
一个字段控制多个状态选项private void GenerateAdvice_OnClick(object sender, RoutedEventArgs e){ TestStatus c1 = TestStatus.A | TestStatus.C | TestStatus.E; v...
效果如下: 代码如下:
StartUp.cs public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseEndpoints(endpoints => { endpoints.MapControllerRoute(