CLI (Common Language Infrastructure)
- CLI is a specification defined by European Computer Manufacturers Association (ECMA).
- This specification is for a virtual machine environment that enables applications written in diverse high-level programming languages to be executed in different system environments without changing or recompiling the original source code.
- CLI also defines a common set of data types called the Common Type System (CTS) that should be used for programs written in any programming language targeting a CLI implementation.
So, CLI specifies a standard intermediate language for the virtual machine to which the high-level language source code is compiled.
CLR (Common Language Runtime)
- The CLR is a standardized environment for the execution of programs written in a wide range of high-level languages including Visual Basic, C#, and C++.
- The specification of the CLR is now embodied in the European Computer Manufacturers Association (ECMA) standard for the Common Language Infrastructure (CLI), ECMA-335, and also in the equivalent ISO standard, ISO/IEC 23271.
- So, The CLR is just one implementation of the CLI specification that executes under Microsoft Windows on a PC.
- With the .NET Framework, intermediate language (defined by CLI) is referred to as Microsoft Intermediate Language (MSIL). Code in the intermediate language is ultimately mapped to machine code by a just-in-time (JIT) compiler when you execute a program.
The CLI is a standard specification; the CLR is Microsoft’s implementation of the CLI.
Code written in the CLI intermediate language can be executed within any other environment that has a CLI implementation.