Notes on .NET (copy paste from other places)

Yes, just copy paste from other places so I can quickly refer to this post later than all those other posts. I don’t know much about .NET but had to read a bit about it today, so figured I might as well put some snippets here.

.NET Framework has two components:

  1. Common Language Runtime (CLR)
  2. .NET Framework Class Library

The CLR is like the foundation/ core of the .NET Framework. It “manages memory, thread execution, code execution, code safety verification, compilation, and other system services. These features are intrinsic to the managed code that runs on the common language runtime. Code that targets the runtime is known as managed code, while code that does not target the runtime is known as unmanaged code. The managed environment of the runtime eliminates many common software issues. For example, the runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors, memory leaks and invalid memory references. The runtime also accelerates developer productivity. For example, programmers can write applications in their development language of choice, yet take full advantage of the runtime, the class library, and components written in other languages by other developers. Any compiler vendor who chooses to target the runtime can do so. Language compilers that target the .NET Framework make the features of the .NET Framework available to existing code written in that language, greatly easing the migration process for existing applications.” (source)

The .NET Framework Class Library is “a collection of reusable types that tightly integrate with the common language runtime. The class library is object oriented, providing types from which your own managed code can derive functionality. For example, the .NET Framework collection classes implement a set of interfaces that you can use to develop your own collection classes. Your collection classes will blend seamlessly with the classes in the .NET Framework.” (source)

“Each version of the .NET Framework contains the common language runtime (CLR), the base class libraries, and other managed libraries. Each new version of the .NET Framework retains features from the previous versions and adds new features. The CLR is identified by its own version number. The .NET Framework version number is incremented at each release, although the CLR version is not always incremented. For example, the .NET Framework 4, 4.5, and later releases include CLR 4, but the .NET Framework 2.0, 3.0, and 3.5 include CLR 2.0. (There was no version 3 of the CLR.)” (source)

“In general, you should not uninstall any versions of the .NET Framework that are installed on your computer, because an application you use may depend on a specific version and may break if that version is removed. You can load multiple versions of the .NET Framework on a single computer at the same time. This means that you can install the .NET Framework without having uninstall previous versions.” (source)

“The .NET Framework 4.5 is an in-place update that replaces the .NET Framework 4 on your computer, and similarly, the .NET Framework 4.5.1 4.5.2, 4.6, 4.6.1, and 4.6.2 are in-place updates to the .NET Framework 4.5, which means that they use the same runtime version, but the assembly versions are updated and include new types and members. After you install one of these updates, your .NET Framework 4, .NET Framework 4.5, or .NET Framework 4.6 apps should continue to run without requiring recompilation. However, the reverse is not true. We do not recommend running apps that target a later version of the .NET Framework on the an earlier version of the .NET Framework. For example, we do not recommend that you run an app the targets the .NET Framework 4.6 on the .NET Framework 4.5.” (source)

How to determine which .NET Framework versions are installed – see here. Basically, check the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP registry subkey. The versions are listed as subkeys under this. In each of those subkeys an entry called Version has the version number.

NET Versions

If you have .NET 4.5 and above installed there will be an additional key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. The Release entry in this key indicates the version of .NET Framework.

NET 45

In the screenshot above Release 379893 corresponds to .NET Framework 4.5.2.

Lastly, what is the .NET Multi-Targeting Pack? It was to learn more about it that I started reading about .NET today. Found this post about it but it mostly went over my head. :) Best I could understand is that it is used as part of compiling programs and installed as part of Visual Studio so doesn’t matter much from a Sys Admin point of view.