vb.net 当我将源代码编译为 .net 框架中的 exe 文件时会发生什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13985530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 11:38:17  来源:igfitidea点击:

what happens when i compile source code to exe file in .net framework

c#.netvb.netcompilationexe

提问by irror

What happens when I compile .NET source code (c# or vb) to .exe file? I wish to understand the process which happens during making an exe file and have viewed several questions regarding reverse engineering and decompilation (for example, How do I decompile a .NET EXE into readable C# source code?and What happens when user click .NET assembly (EXE)?)

当我将 .NET 源代码(c# 或 vb)编译为 .exe 文件时会发生什么?我希望了解在制作 exe 文件期间发生的过程,并查看了有关逆向工程和反编译的几个问题(例如,如何将 .NET EXE 反编译为可读的 C# 源代码?以及用户单击 .NET 程序集时会发生什么) (EXE)?)

Thanks in advance

提前致谢

回答by MUG4N

The managed execution process includes the following steps

托管执行过程包括以下步骤

  1. Choosing a compiler

    To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.

  2. Compiling your code to MSIL

    Compiling translates your source code into Microsoft intermediate language (MSIL) and generates the required metadata.

  3. Compiling MSIL to native code

    At execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During this compilation, code must pass a verification process that examines the MSIL and metadata to find out whether the code can be determined to be type safe.

  4. Running code

    The common language runtime provides the infrastructure that enables execution to take place and services that can be used during execution.

  1. 选择编译器

    要获得公共语言运行时提供的好处,您必须使用一种或多种面向运行时的语言编译器。

  2. 将代码编译为 MSIL

    编译会将您的源代码转换为 Microsoft 中间语言 (MSIL) 并生成所需的元数据。

  3. 将 MSIL 编译为本机代码

    在执行时,即时 (JIT) 编译器将 MSIL 转换为本机代码。在此编译期间,代码必须通过检查 MSIL 和元数据的验证过程,以确定代码是否可以确定为类型安全的。

  4. 运行代码

    公共语言运行时提供了使执行能够发生的基础结构以及可以在执行期间使用的服务。

look here for detailled information: http://msdn.microsoft.com/en-us/library/k5532s8a.aspx

在此处查看详细信息:http: //msdn.microsoft.com/en-us/library/k5532s8a.aspx

回答by Sanfoor

you may take a look on the following links that i think they are usefull,
1- Image Describing CLR.
2- Wikipedia Description of .NET Framework
3- .Net Framework Architecture

您可以查看以下我认为有用的链接,
1- Image Describing CLR。
2- .NET Framework
3- .NET Framework 架构的维基百科描述