Somewhere, I heard that .NET code can be compiled not into MSIL (Microsoft Intermediate Language), but straight into the binary. It seems like only with Visual Studio (and not Mono).

  • Is it possible or am I mistaken?
  • Only VS or Mono can compile into a binary too?
  • Compiling into machine code gives a performance benefit relative to compiling into IL?
I would be glad to get an answer even one of the questions posed.
PS: Sori, if you violated the rules of the portal, having pushed three questions here at once.

    2 answers 2

    • This is possible using the NGen.exe utility.
    • It is unlikely that there is something like ngen.exe for Lixux.
    • Compilation gives a gain in load time, but does not give a significant gain during operation, as all the same the application works on the basis of .NET and JIT is used.

    Article on MSDN: Compiling MSIL into native code .

      The ability to precompile into machine code of .Net assemblies is present, for such purposes Ngen exists (more on MSDN ):

      The image generator in native code (Ngen.exe) is a tool for improving the speed of managed applications. Ngen.exe creates machine-side images, which are files that contain the compiled processor-specific machine code, and installs them into the machine-image cache on the local computer. The runtime may use cached images in machine code instead of using the JIT compiler to compile the original assembly.

      However, the implementation requires the presence of the installed .Net framework and the assembly itself, for which precompilation is performed.