Gacutil.exe 成功添加程序集,但程序集在资源管理器中不可见。为什么?
我正在 Visual Studio 命令提示符 2010 中运行 GacUtil.exe,以将 dll (CatalogPromotion.dll) 注册到 GAC。运行该实用程序后,它显示程序集已成功添加到缓存
,并且运行gacutil /l CatalogPromotionDll
显示GAC包含该程序集,但我看不到该程序集当我从 Windows 资源管理器导航到 C:\WINDOWS\Assembly 时。 为什么我在 Windows 资源管理器中看不到 WINDOWS\Assembly 中的程序集,但我可以使用 gacutil.exe 看到它?
背景:这是我在 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
但是,程序集不显示在 C:\WINDOWS\Assembly 中。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是因为您使用 .NET 4.0 版本的 gacutil.exe。它将程序集存储在不同的GAC中,即c:\windows\microsoft.net\ assembly中的GAC。所有 .NET 4.0 程序集的存储位置。该文件夹没有 shell 扩展处理程序,文件夹按原样可见。您可以使用Windows资源管理器查看一下,您将看到GAC文件夹的内部结构。您应该不会遇到任何问题找回您的程序集,GAC 并不是特别复杂。
如果程序集旨在由面向早期版本 .NET 的应用程序使用,则应使用 .NET 2.0 版本的 gacutil.exe,存储在 C:\Program Files\Microsoft SDKs\Windows\v6.0A\ 中垃圾桶
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
路径是-> C:\Windows\Microsoft.NET\Assembly\GAC_MSIL,其中存储 .net 4.0 版本的所有程序集
The path is -> C:\Windows\Microsoft.NET\assembly\GAC_MSIL where all the assemblies are stored for .net 4.0 version
这是因为您安装到 GAC 中的程序集是针对 4.0 运行时编译的。 4.0 GAC 程序集存储在不同的位置 c:\windows\microsoft.net\assembly。
接受的答案是不正确的。使用 .NET 4.0 gacutil 安装针对 3.5 或更早运行时编译的程序集效果很好,并且会将程序集放置在 OP 期望的目录中,c:\windows\ assembly。
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.