views:

586

answers:

1

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.

+4  A: 

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. Navigating them isn't exactly practical.

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

Hans Passant
@Hans The assembly is intended to be used by a VB6 app with COM. I tried using the 3.5 version of gacutil.exe in `\v7.0.A\bin`, but that version of the utility can't install .NET 4.0 assemblies.
Ben McCormack
VB6 doesn't care what version of .NET you use. It will work fine with .NET 4.0. You might want to start thinking about how you get this deployed on the target machine. No gacutil.exe available there, you have to create a Setup project. Avoid GAC hassles while you debug this by using the Regasm.exe /codebase option.
Hans Passant
@Hans thanks for the advice. Can you point me in a direction where I can read more about the regasm.exe /codebase? I've been thinking about issues related to deployment, and you bring up a good point that gacutil.exe won't be available there. I'm just trying to feel around to see how this is supposed to be done when using .NET components in a VB6 app.
Ben McCormack
It is well described in the MSDN Library article for it. Nothing much to it, it simply records the directory in which the DLL is located. Installing it in the GAC on the target machine is wise to avoid COM DLL Hell. Easy to do with a Setup project.
Hans Passant