.Net"中不可见?-6ren"> .Net"中不可见?-只是有一个关于 GAC 的快速问题 我创建了一个程序集 Awesome.DLL。签名后安装到 GAC 中: C:\MyApps\Awesome\Awesome\Awesome\bin\Release>-6ren">
gpt4 book ai didi

.net - 为什么我的程序集在安装到 GAC 时在 "Add Reference > .Net"中不可见?

转载 作者:行者123 更新时间:2023-12-03 23:34:34 24 4
gpt4 key购买 nike

只是有一个关于 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\我想正因为如此,我无法从 Add Reference > .Net 看到 Awesome.DLL。

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

最佳答案

您的组件已安装到 C:\WINDOWS\Microsoft.NET\assembly\而不是 C:\Windows\Assembly\因为它是 .Net 4.0 程序集,并且 .Net 框架 4.0 版在该位置有一个新的单独 GAC。 GAC 位于 C:\Windows\Assembly\仅包含 .Net 2.0 - 3.5 程序集。 (见 .NET 4.0 has a new GAC, why?)。

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

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

  • How to: Add or Remove References in Visual Studio

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

    关于.net - 为什么我的程序集在安装到 GAC 时在 "Add Reference > .Net"中不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5113186/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com