Search code examples
.netvisual-studioframeworkscil

Is the source code to Common Interpreted Language compiler located within the CLR in .NET


I am aware that .NET compliant source code is first compiled to CIL and then to native code by the JIT compiler within the CLR but I was wondering whether the first compilation is made within the CLR or the Visual Studio environment by a separate compiler.


Solution

  • The language specific compiler transforms the code into IL (or CIL, or MSIL) and packages it as a .dll or .exe file/s, which is ultimately executed by the CLR.

    The below image illustrates the steps that are performed in order for your code to be executed.

    If you want, you can use ILSpy or what Microsoft delivers as part of the .NET framework (ILDasm) to disassemble the .dll or .exe and view the IL code. (Those are not the only disassemblers, but they are free)

    enter image description here