Gacutil.exe successfully adds assembly, but assembly not viewable in explorer. Why?

.NetWindowsAssembliesGacGacutil

.Net Problem Overview


I'm running GacUtil.exe from within Visual Studio Command Prompt 2010 to register a dll (CatalogPromotion.dll) to the GAC. After running the utility, it says Assembly Successfully added to the cache, and running gacutil /l CatalogPromotionDll shows that the GAC contains the assembly, but I can't see the assembly when I navigate to C:\WINDOWS\assembly from Windows Explorer. Why can't I see the assembly in WINDOWS\assembly from Windows Explorer but I can see it using gacutil.exe?


Background: Here's what I typed into the command prompt for VS Tools:

C:\_Dev Projects\VS Projects\bmccormack\CatalogPromotion\CatalogPromotionDll\bin
\Debug><b>gacutil /i CatalogPromotionDll.dll</b>
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

<b>Assembly successfully added to the cache</b>

C:\_Dev Projects\VS Projects\bmccormack\CatalogPromotion\CatalogPromotionDll\bin
\Debug><b>gacutil /l CatalogPromotionDll</b>
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  CatalogPromotionDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9188a175
f199de4a, processorArchitecture=MSIL

<b>Number of items = 1</b>

However, the assembly doesn't show up in C:\WINDOWS\assembly.

.Net Solutions


Solution 1 - .Net

That's because you use the .NET 4.0 version of gacutil.exe. It stores the assembly in a different GAC, the one in c:\windows\microsoft.net\assembly. Where all .NET 4.0 assemblies are stored. There is no shell extension handler for that one, the folders are visible as-is. You can have a look-see with Windows Explorer, .you'll see the internal structure of the GAC folders. You shouldn't have any trouble finding your assembly back, the GAC isn't particularly complicated.

If the assembly is intended to be used by an app that targets an earlier version of .NET then you should use the .NET 2.0 version of gacutil.exe, stored in C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

Solution 2 - .Net

The path is -> C:\Windows\Microsoft.NET\assembly\GAC_MSIL where all the assemblies are stored for .net 4.0 version

Solution 3 - .Net

This is because the assembly you are installing into the GAC was compiled targeting the 4.0 runtime. 4.0 GAC assemblies are stored in a different location c:\windows\microsoft.net\assembly.

The accepted answer is incorrect. Using the .NET 4.0 gacutil to install an assembly compiled targeting 3.5 or earlier runtime works just fine, and will place the assembly in the directory the OP was expecting, c:\windows\assembly.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBen McCormackView Question on Stackoverflow
Solution 1 - .NetHans PassantView Answer on Stackoverflow
Solution 2 - .NetbijitmView Answer on Stackoverflow
Solution 3 - .NetgravidThoughtsView Answer on Stackoverflow