Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

.net - 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:WINDOWSassembly from Windows Explorer. Why can't I see the assembly in WINDOWSassembly 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 ProjectsVS ProjectsmccormackCatalogPromotionCatalogPromotionDllin
    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 ProjectsVS ProjectsmccormackCatalogPromotionCatalogPromotionDllin
    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:WINDOWSassembly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:windowsmicrosoft.netassembly. 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 FilesMicrosoft SDKsWindowsv6.0Ain


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...