Wednesday, February 9, 2011

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

When you double click on a .net .exe assembly

  • Windows' PE (Portable Executable) 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.




  • Reference :
    http://stackoverflow.com/questions/2788270/what-happens-when-user-click-net-assembly-exe

    http://maneshjoseph.blogspot.com/2010/10/what-happens-when-you-click-on-net-exe.html

    No comments: