I wanted to become more familiar with the .Net Global Assembly Cache. Various sources online say it can be found in Explorer in C:\WINNT\Assembly
. But I don't seem to have a WINNT
folder under C:
on my Windows XP machine. I have "Show Hidden Files and Folders" checked and "Hide Protected Operating System Files" UN-checked.
Using the methods described in How do I detect what .NET Framework versions and service packs are installed? and especially in http://msdn.microsoft.com/en-us/kb/kbarticle.aspx?id=318785 I see that I have .Net 4.0 installed.
How can I reliably find it and why would it be anywhere but where it's supposed to be?
As a disclaimer, I'm going to start by saying that you should never directly edit the contents of your GAC.
Moving on to the information...
There are two different GAC's in play in your question, the 2.0 GAC and the 4.0 GAC. When talking about these, they aren't so much referring to the version of the .NET framework, so much as the version of the CLR being used. It just so happens that in 2.0, the CLR is 2, and in 4.0, the CLR is 4. As a frame of reference, the CLR for .Net 3.5 stayed at 2, and hence the GAC for .net 2.0 and .net 3.5 is the same.
But where is it?
The 2.0 GAC is at %WINDIR%\Assembly
in explorer. For most newer Windows OS's, %WINDIR%
is C:\Windows
by default. Under the hood, this is actually a shell extension hiding the real location of the GAC, but for your purposes, you open explorer to C:\Windows\Assembly
to view the contents of the 2.0 GAC. The shell extension also adds the benefit of dragging and dropping assemblies into C:\Windows\Assembly
in order to add them to the GAC (UAC must be disabled in Win7 and up.)
The 4.0 GAC is at C:\Windows\Microsoft.NET\assembly
. You'll find the various types of assemblies divided up into their 32-bit, 64-bit, or MSIL subdirectories under that folder. There is no shell extension for CLR4's gac, so you're looking at the actual place on disk where the assemblies live.
Somewhat off-topic...
The way that I always programmatically detect what versions of the .Net framework are installed is to look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
... the sub-folders indicate installed versions.