安装到GAC后,为什么我的程序集在"添加参考> .Net"中不可见?

Joh*_*ohn 13 .net gac gacutil .net-4.0

关于GAC
我有一个快速的问题我创建了一个程序集Awesome.DLL.如果它已签名,则安装到GAC中:

C:\MyApps\Awesome\Awesome\Awesome\bin\Release>sn -k Awesome.snk
Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.1 
Copyright (c) Microsoft Corporation.  All rights reserved.

Key pair written to Awesome.snk

C:\MyApps\Awesome\Awesome\Awesome\bin\Release>gacutil /i Awesome.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:\MyApps\Awesome\Awesome\Awesome\bin\Release>gacutil /l Awesome.dll 
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
Run Code Online (Sandbox Code Playgroud)

我的问题:

C:\Windows\Assembly在任何子文件夹中找不到Awesome.DLL .虽然C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\因为这个原因,我发现它无法从Add Reference> .Net中看到Awesome.DLL.

为什么不安装C:\Windows\Assembly\?我怎么能指向那个位置呢?

Jus*_*tin 18

您的程序集已安装,C:\WINDOWS\Microsoft.NET\assembly\而不是C:\Windows\Assembly\因为它是.Net 4.0程序集,而.Net framework 4.0版在该位置有一个新的单独GAC.位于的GAC C:\Windows\Assembly\仅包含.Net 2.0 - 3.5程序集.(参见.NET 4.0有一个新的GAC,为什么?).

在Visual Studios"Add Reference - > .Net"中找到的程序集列表.对话框不仅仅是在GAC中找到的程序集列表(请注意,该列表中的大多数条目也未在GAC中找到).

有关如何将程序集添加到此列表的信息,请参阅以下文章(特别是"在"添加引用"对话框中显示程序集"部分):

请注意,对于不同版本的Visual Studio,用于此目的的注册表项是不同的.