Where is the location of GAC?
in windows xp, its c:\windows\ and its a hidden folder and can find it by manually typing the directory as where you GAC is (WINNT was .NT 4.0 server or workstation, or windows server 2000, or windows 2000) and if upgraded to windows xp or windows server 2003 WINNT I believe would stay intact only in that scenario, that's what you should use the %windir% global system variable
Im on windows 8.1 64 bit and the gac is still in C:\Windows\assembly
but .net is in c:\windows\Microsoft.NET\ is where the CLR and runtime is
Oddly to the other answer above, it seems I disagree that c:\windows\assembly is the "old gac"
here is my dos results
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>cd..
C:\Windows>cd assembly
C:\Windows\assembly>dir
Volume in drive C is OS
Volume Serial Number is DE26-14AA
Directory of C:\Windows\assembly
11/01/2013 01:15 PM <DIR> GAC
11/14/2013 01:10 PM <DIR> GAC_32
11/14/2013 01:10 PM <DIR> GAC_64
11/14/2013 01:27 PM <DIR> GAC_MSIL
11/13/2013 05:36 PM <DIR> NativeImages_v2.0.50727_32
11/10/2013 03:22 AM <DIR> NativeImages_v2.0.50727_64
11/14/2013 01:33 PM <DIR> NativeImages_v4.0.30319_32
11/13/2013 05:36 PM <DIR> NativeImages_v4.0.30319_64
11/14/2013 01:33 PM <DIR> temp
11/14/2013 01:32 PM <DIR> tmp
0 File(s) 0 bytes
10 Dir(s) 27,701,415,936 bytes free
C:\Windows\assembly>
the c:\windows\microsoft.net\assembly I do not think is your Active GAC, I think this is where Visual Studio looks for, when compiling for a specific version x64 or 32 etc, the other c:\windows\assembly is the current state of your machine. but im no expert, just what I see
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.