.Net Framework, compiled or translated?

Sorry but I have this basic question, is about plataform .NET Framework, I'd like to know if the final result is a machine compiled code compatible with .NET FW or is a .NET FW code to be translated in runtime as with Java .

Too, I'd like to know about the same but with C# and Basic. We know that pure C++ code is optimized machine code, but how works C# or Basic about this .

Thanks.


Answer this question

.Net Framework, compiled or translated?

  • John R. Meek

    Hi,

    Check out the following article for more in-depth info:
    http://msdn.microsoft.com/msdnmag/issues/05/04/NGen/default.aspx


    Regards,
    Vikram

  • Stefan Knoche

    The tool is ngen.exe. I'll add the following distinction to the answer: You can generate binary images during deployment for your assemblies, you can't distribute naitve images.

    Diego Gonzalez
    Lagash Systems SA
    C# MVP

  • Lisa Nicholls

    Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.
    For more infromation about the GAC, see the following link:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpguide/html/cpconglobalassemblycache.asp


  • Peter Moretti

    NGen takes a MSIL assembly and generates the native image for it. The generated native code uses machine specific instructions for optimization reasons, so you have to generate the MSIL assembly first and use the NGen on the deployment computers.
    The generated native image is found in the Global Assembly Cache. When you try to load the assembly, the CLR loads the native image from the GAC instead of loading the MSIL assembly.


  • jaybs

    I don't have very clear how 'ngen' works, what image it generate, or when I type 'ngen /show' what is that list, because I don't have generated nothing yet. Where it put the native images , description says that it 'install the image in the local cache' ( ).

    A bit confusing.

  • Glenfar

    I see, but what is the "Global Assembly Cache" , it is a directory in system HD .

  • Tomcat68

    Hi,

    The .NET compilers convert the code to MSIL - Microsoft Intermediate Language which is something similar to Java bytecodes. This is then converted to machine language by the JIT Compiler at runtime.
    Read more here.

    You can however choose to create a native image using tools provided by the .NET SDK:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpguide/html/cpconjitcompilation.asp

    Regards,
    Vikram

  • RobertBCran

    Are you talking about 'ilasm.exe' and 'ildasm.exe' .

    Then we must suppose that C# and Basic always generate MSIL, not .

    Thanks.

  • .Net Framework, compiled or translated?