Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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>gacutil /i CatalogPromotionDll.dll     Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1     Copyright (c) Microsoft Corporation.  All rights reserved.      Assembly successfully added to the cache      C:\_Dev Projects\VS Projects\bmccormack\CatalogPromotion\CatalogPromotionDll\bin     \Debug>gacutil /l CatalogPromotionDll     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      Number of items = 1  

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

like image 751
Ben McCormack Avatar asked Jun 16 '10 14:06

Ben McCormack


People also ask

How do I know if assembly is installed in GAC?

If you dont care that the assembly is actually in the GAC, but just loadable on the machine (from the appdomain) you can just use LoadAssembly with the assemblies name (strong, common, full, etc). If the assembly can be loaded by Fusion it will be and then you will know it exists.

Where can I find GAC assemblies?

Starting with the . NET Framework 4, the default location for the Global Assembly Cache is %windir%\Microsoft.NET\assembly. In earlier versions of the . NET Framework, the default location is %windir%\assembly.

Where is Gacutil installed?

The Gacutil.exe tool is located in the . NET Framework installation directory. The default location for this is C:\Program Files (x86)\Microsoft SDKs\Windows\v10.

How do I run Gacutil exe?

This tool is automatically installed with Visual Studio. To run the tool, use Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell.

How do I remove multiple assemblies in gacutil?

For example, if both version 1.0.0.0 and 3.2.2.1 of hello are installed in the cache, the command gacutil /u hello removes both of the assemblies. Use the following example to avoid removing more than one assembly.

Where does gacutil store assembly files?

That's because you use the .NET 4.0 version of gacutil.exe. It stores the assembly in a differentGAC, the one in c:\windows\microsoft.net\assembly. Where all .NET 4.0 assemblies are stored.

What is gacutil Exe?

Gacutil.exe (Global Assembly Cache Tool) The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache. This tool is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt for Visual Studio (or the Visual Studio Command Prompt in Windows 7).

Why is my GAC Assembly not installing?

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.


1 Answers

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

like image 80
Hans Passant Avatar answered Sep 24 '22 02:09

Hans Passant