16 February 2013 CI Team

p>.NET 4.0 offers a new Global Assembly Cache (GAC) which you can find at this path:

C:\Windows\Microsoft.NET\assembly

Every .NET 4.0 or CLR 4.0 application use this GAC.

What happens to the „old“ GAC?

The old GAC still exists on this path:

C:\Windows\assembly

It is still responsible for .NET 2.0 - .NET 3.5 or CLR 2.0 applications.

CLR? .NET Framework Version? Isn’t that the same thing?

The subject is a little more difficult but I like it as a short form:

CLR + Libraries = .NET Framework

While CLR is the base of the execution. With several .NET framework versions they added numerous libraries but there are just two big CLR Versions till today – Version 2.0 and 4.0

Source

Why this change?

At this point I want to name my source: Stackoverflow

“In .NET Framework 4.0, the GAC went through a few changes. The GAC was split into two, one for each CLR.

The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. There was no need in the previous two framework releases to split GAC. The problem of breaking older applications in Net Framework 4.0.

To avoid issues between CLR 2.0 and CLR 4.0 , the GAC is now split into private GAC’s for each runtime.The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC.”

Reason for the change:

For example, if both .NET 1.1 and .NET 2.0 shared the same GAC, then a .NET 1.1 application, loading an assembly from this shared GAC, could get .NET 2.0 assemblies, thereby breaking the .NET 1.1 application

“The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. As a result of this, there was no need in the previous two framework releases to split the GAC. The problem of breaking older (in this case, .NET 2.0) applications resurfaces in Net Framework 4.0 at which point CLR 4.0 released. Hence, to avoid interference issues between CLR 2.0 and CLR 4.0, the GAC is now split into private GACs for each runtime.”

Another point:

“Mark Miller said… June 28, 2010 12:13 PM

Thanks for the post. “Interference issues” was intentionally vague. At the time of writing, the issues were still being investigated, but it was clear there were several broken scenarios.

For instance, some applications use Assemby.LoadWithPartialName to load the highest version of an assembly. If the highest version was compiled with v4, then a v2 (3.0 or 3.5) app could not load it, and the app would crash, even if there were a version that would have worked. Originally, we partitioned the GAC under it’s original location, but that caused some problems with windows upgrade scenarios. Both of these involved code that had already shipped, so we moved our (version-partitioned GAC to another place.

This shouldn’t have any impact to most applications, and doesn’t add any maintenance burden. Both locations should only be accessed or modified using the native GAC APIs, which deal with the partitioning as expected. The places where this does surface are through APIs that expose the paths of the GAC such as GetCachePath, or examining the path of mscorlib loaded into managed code.

It’s worth noting that we modified GAC locations when we released v2 as well when we introduced architecture as part of the assembly identity. Those added GAC_MSIL, GAC_32, and GAC_64, although all still under %windir%\assembly. Unfortunately, that wasn’t an option for this release.”

This message helped me to get a clearer view on the subject. Also I didn’t know that the weird „Assembly-Viewer“ has been removed from Windows 8:

 

image

 

Result:

Good to know

1269602956_dr-mccoy-and-captain-kirk-approve