CLR and CLI - What is the difference?

.NetClrCommand Line-Interface

.Net Problem Overview


I want to know what exactly is the difference between CLR & CLI? From whatever I have read so far, it seems to indicate that CLI is a subset of CLR. But isn't everything in the CLR mandatory? What exactly may be left out of CLR to create a CLI?

.Net Solutions


Solution 1 - .Net

The CLR is Microsoft's implementation of the CLI standard.

Solution 2 - .Net

CLR is the execution environment in which a .NET application is safely hosted/run.

You can see it as .NET's private Operating System that initiates and loads just before a .NET application starts.

The CLR takes care of certain essential requirements of any .NET application that otherwise would require lot of deliberate code to be written in order to implement; requirements that are holistic in nature and essential to any kind of application to run in a good, efficient and safe manner [e.g. Handle memory allocation and release it when not required, avoid dangling pointers, avoid type-casting errors etc. ]

CLI on the other hand is a specification/set of guidelines that explains how to implement an application execution environment and the nature of generated application code that allows for multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures.

CLI is developed by Microsoft and standardized by ISO and ECMA.

The CLR is a practical implementation of CLI's VES [Virtual Execution System] section and forms one of the core components of the MS.NET platform

In a layman's language, CLI is a recipe while CLR is the cuisine :-)

Solution 3 - .Net

The CLR (Common Language Runtime) is Microsoft's implementation of the VES (Virtual Execution System). The VES along with the CTS (Common Type System), the CLS (common language specification) and the metadata specification are all part of the CLI (Common Language Infrastructure) specification.

The VES is a standardized virtual machine specification that must be implemented in order to load and execute CIL (Common Intermediate Language) modules (dll and exe). A VES implementation also provide runtime services such as garbage collection and security.

ECMA C# and Common Language Infrastructure Standards

Solution 4 - .Net

CLR is the .net execution environment where all kind of .net applications are run.For instance, when you write your code with C# or another language from the dot NET stack the compiler compiles and converts it into managed module. A managed module is IL (intermediate language) and metadata.Above all, the important point to remember is that whenever you compile your source code, the compiler translates it into managed module. To clarify, this is not a machine code that your processor will execute.In fact, IL is an intermediate language close to assembly language.Similarly, it is also famous as object orientated machine language.

Check this article about more detailed explanation:

http://alevryustemov.com/programming/common-language-runtime/

Solution 5 - .Net

The Common Language Runtime (CLR) is programming that manages the execution of programs written in any of several supported languages, allowing them to share common object-oriented classes written in any of the languages. It is a part of Microsoft's .NET Framework. The CLR is somewhat comparable to the Java virtual machine that Sun Microsystems provides for running programs compiled from the Java language. Microsoft refers to its CLR as a "managed execution environment." A program compiled for the CLR does not need a language-specific execution environment and can easily be moved to and run on any system with Windows 2000 or Windows XP.

While

Common Language Infrastructure is a standard developed by Microsoft that allows the use of multiple different high-level languages on different computer platforms without rewriting the code for any specific architecture. In simple terms, Common Language Infrastructure (CLI) enables an application program written in any commonly-used programming languages to be run on any operating system using a common runtime program rather than a specific for every language. The .NET Framework, .NET Core, and Mono are some implementations of CLI.

Solution 6 - .Net

As answered, CLR is microsoft implementation. The component itself is called C++/CLI in Visual Studio installer but once it's installed, it shows up as CLR.

You can got to add remove programs >> Visual Studio 2009, modify installation and add or remove C++/CLI. It is listed like that as shown in screenshot below but again once installed, the project type is called CLR in visual studio.

enter image description here

Solution 7 - .Net

CLR is the complete environment in which CLI ,CTS,CLS works in integration it also incluse garbage collection,memory management ,security,intemediate language for native code... CLI is a specification for the format of executable code, and the runtime environment that can execute that code.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNaveenView Question on Stackoverflow
Solution 1 - .NetSerafina BrociousView Answer on Stackoverflow
Solution 2 - .NetRahul BhatnagarView Answer on Stackoverflow
Solution 3 - .NetxtremView Answer on Stackoverflow
Solution 4 - .NetAlev RyustemovView Answer on Stackoverflow
Solution 5 - .NetMfoniso UkpabioView Answer on Stackoverflow
Solution 6 - .NetzarView Answer on Stackoverflow
Solution 7 - .NetmaddyView Answer on Stackoverflow