4

I have an assembly: SomeAssembly.dll

I have GACUtil's folder on my path: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools

I change to the folder where SomeAssembly.dll is, execute

GACUtil /i SomeAssembly.dll

The response is:

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

I check C:\Windows\Assembly, but my assembly does not appear to be there.

I return to my command window (which I note has Administrator rights) and type:

GACUtil /l SomeAssembly.dll

and the response confirms...

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:

Number of items = 0

So It seems SomeAssembly.dll is not in the GAC

Why?

4

1 回答 1

8

使用时不要.dll使用扩展名gacutil /l,它应该正确报告您的程序集。

另外,我怀疑可能会发生某种 32/64 位混淆。当您C:\Windows\Assembly通过 Windows 资源管理器查看时,您可能只看到 32 位 GAC。

[更新:看起来 .NET 4 将 GAC 程序集存储在其中,C:\Windows\Microsoft.NET\assembly因此您只能在 .NET 中看到 CLR v2.0 程序集C:\Windows\assembly。]

要查看 (v2 CLR) GAC 目录的真实内容,请在不使用 Explorer shell 扩展的情况下查看它 - 一种快速的方法是将驱动器映射到目录subst并通过它查看它,例如:

C:\>subst G: c:\Windows\assembly
C:\>start G:
于 2013-01-08T17:38:56.330 回答