While reading an article on Understanding The CLR Binder, I found out that .NET 4.0 has 2 distinct GAC’s (Global Assembly Cache). In previous .NET versions, when I installed a .NET assembly into the GAC (using gacutil.exe), I could find it in the ‘C:\Windows\assembly’ path. With .NET 4.0, GAC is now located in the 'C:\Windows\Microsoft.NET\assembly’ path.
Note that previous versions of .NET continue using the same ‘C:\Windows\assembly’ path. The article says:
In .NET Framework 4.0, the GAC went through a few changes. The concept of placing assemblies into a global directory began in CLR v1.1. In case of .NET Framework 1.1 (which had CLR v1.1) and .NET Framework 2.0 (which had CLR 2.0), the GAC was split into two, one for each CLR. This avoided the leaking of assemblies across CLR versions. 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.”
Interference Issues? Hmm..Interesting although I am still pondering over the reason! So that means, the GAC split reasoning in a .NET 4.0 scenario could be re-quoted as “If both .NET 2.0 and .NET 4.0 shared the same GAC, then a .NET 2.0 application, loading an assembly from this shared GAC, could get .NET 4.0 assemblies, thereby breaking the .NET 2.0 application”
I am eager to try out a scenario to see it myself. The baseline is, you now have 2 GAC’s in .NET 4.0 and you will now have to manage each of them individually!
Any other reasons you can think of the .NET 4.0 GAC split? Feel free to share them in the comments section.
Giving me +1 tells me you liked this article! Thanks in advance