Home » Asp.Net | Enterprise Library

.NET 4 New GAC Locations/GacUtil

2. March 2011 by David 5 Comments

 This is what I know, let me know if you know otherwise.  There are now 2 distinct GAC locations that you have to manage as of the .NET 4 Framework release.

The GAC was split into two, one for each CLR (2.0, 3.5 AND 4.0).  The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.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.


In previous .NET versions, when I installed a .NET assembly into the GAC (using gacutil.exe or even drag and drop to the c:\windows\assembly directory), 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.


In order to install a dll to the .NET 4 GAC it is necessary to use the gacutil found C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\GacUtil.exe  In addition, you can no longer use the drag n' drop (in reality the drag n' drop really executed the gacutil via a windows explorer extension).


After you use the gacutil.exe -i {path to dll} you can view that it is indeed in the gac via gacutil -l (which will list all dlls in the gac).  I used this command and piped the results to a text file via > out.txt which made it easier to find the recently added component.


I was not able to see my gac object in the directory for .net 4 (i.e. c:\windows\microsoft.net\assembly path).  I am not sure why just yet.  Ideas?


At this point, the object is in the local gac however if you are using vs.net 2010 it will still not show up in the list of references. To get the component to show up in the VS.NET list of references can add a registry entry to HKLM\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx  At this point, the component is in the local GAC and is in the list of references to be used by vs.net.


Note, I did find that if I just added the path to the registry without adding it to the gac it was available to vs.net.  So, because the component is listed via vs.net add references it does not necessarily mean it is in the gac.


What still confuses me is that I am still unable to view my recently added component in the .NET 4 directories above.  Ideas?




Comments (5) -

India Maran said:

Did you get it yet? I mean if I do a gacutil -i FooFramework4.dll, I can actually see it under %windir%\Microsoft.NET\assembly in windows explorer.

United Kingdom magento said:

Thanks for this great and interesting article. I really enjoyed the article.  Really useful and informative for me.

United States Jeff said:

For CLR v2.0, use C:\Windows\Microsoft.NET\assembly\GAC_MSIL and the folders represent the registered assemblies.

India richa sharma said:

.NET 4 New GAC Locations,clr version used both version you did gave the difference between CLR2.0 and CLR 4.0.
thanks for sharing......

India Vijay Kumar Reddypogu said:

Nice information, gactuil of 4.0 is working fine for all the versions, except the location; ie., for below 4.0 "C:\Windows\assembly" and for 4.0, "C:\Windows\Microsoft.NET\assembly" based on 32 or 64 bits.

Pingbacks and trackbacks (1)+

Add comment



  Country flag
biuquote
  • Comment
  • Preview
Loading







Current HOT Blog List...

These are blog entries that I have found interesting and are worth checking out.
Forbidden