为什么我的程序集在“添加引用”中不可见.Net”什么时候安装到GAC?

发布于 2024-10-18 22:05:19 字数 1175 浏览 1 评论 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

我的问题:

C:\Windows\Assembly 或任何子文件夹中找不到 Awesome.DLL。虽然在 C:\WINDOWS\Microsoft.NET\ assembly\GAC_MSIL\ 中找到了它,但我想正因为如此,我无法从“添加引用”中看到 Awesome.DLL > 。网。

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

Just have a quick question about the GAC
I created an assembly Awesome.DLL. Had it signed, then installed into the 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

My problem:

Awesome.DLL is not found in C:\Windows\Assembly or any of the sub folders. It is found, though in C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\ I guess because of this, I am not able to see Awesome.DLL from Add Reference > .Net.

Why does it not install to C:\Windows\Assembly\? How can i point to that location instead?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧城空念 2024-10-25 22:05:19

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

在 Visual Studios“添加引用 -> .Net”中找到的程序集列表。对话框不仅仅是在 GAC 中找到的程序集列表(请注意,该列表中的大多数条目在 GAC 中也找不到)。

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

请注意,对于不同版本的 Visual Studio,用于此操作的注册表项有所不同。

Your assembly is installed to C:\WINDOWS\Microsoft.NET\assembly\ instead of C:\Windows\Assembly\ because it is a .Net 4.0 assembly and the .Net framework version 4.0 has a new separate GAC in that location. The GAC located at C:\Windows\Assembly\ contains only .Net 2.0 - 3.5 assemblies. (see .NET 4.0 has a new GAC, why?).

The list of assemblies found in Visual Studios "Add Reference -> .Net." dialog is not simply a list of assemblies found in the GAC (notice that most of the entries in that list aren't found in the GAC either).

For information on how to add your assembly to this list see the following article (specifically the "To display an assembly in the Add Reference dialog box" section):

Note that the registry key used for this is different for different versions of Visual Studio.

双马尾 2024-10-25 22:05:19

我创建了一个完全免费的工具,它将帮助您实现目标。 Muse VSReferences 将允许您添加全局程序集缓存引用从“添加 GAC 参考”菜单项添加到项目。

希望这有帮助。

I've created a tool which is completely free, that will help you to achieve your goal. Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item.

Hope this helps.

情独悲 2024-10-25 22:05:19

在 vs2010 项目菜单下检查您的项目属性:
我看到这个项目是“.NET Framework 4 Client Profile”,程序集是“.NET 4 Fraemwork”。
解决方案 :
将项目更改为“.NET Framework 4”配置文件

Check your project properties under vs2010 Project menu:
i've seen this were the project is ".NET Framework 4 Client Profile" and the assembly is ".NET 4 Fraemwork".
solution :
Change the project to ".NET framework 4" profile

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文