What happens when user click .NET assembly (EXE)?

前端 未结 3 1337
旧巷少年郎
旧巷少年郎 2021-02-04 03:42

Consider we have .NET Winforms application or Console Application. Can anyone tell me what will happen step-by-step until the WinForm or Console Application is launched. I would

3条回答
  •  不知归路
    2021-02-04 04:13

    When you double click on a .net .exe assembly:

    • Windows' PE loader kicks in
    • If you're on a Windows >= Windows XP it will detect that the executable is a managed executable and will forward it to .net by calling _CoreExeMain in mscoree.dll (_CoreDllMain if you double clicked on a managed .dll). It can use the assembly configuration file to know which runtime to use.
    • If you're on Windows < Windows XP, the .exe file contains a small native piece of code that will jump to mscoree.dll's _CoreExeMain or _CoreDllMain.
    • Then mscoree.dll initializes the .net runtime, depending on the global configuration, the assembly configuration file, and what not.
    • Then if it's a .exe, it will JIT compile its entry point method, and start executing it.

提交回复
热议问题