安装到 GAC 中的程序集未显示在 Visual Studio 中

发布于 2024-08-16 17:14:28 字数 1163 浏览 8 评论 0原文

这听起来与这个问题相关,但是它们不是同一件事。该问题没有出现任何程序集。我的除了我安装的那个之外什么都有。

我希望有人能解决这个问题......我做错了什么吗?还是我在VS中发现了一些bug?

我在 Windows 7 Ultimate 上使用 Visual Studio 2010 Professional Beta 2。我刚刚下载了 Rhino Mocks 并决定使用命令行实用程序 GACUTIL 将其安装到 GAC 中。然后我重新启动。

您可以在此处看到我的 GAC 中的程序集(点击放大):

alt text

以下是 Visual Studio 中可用的程序集列表:

alt text

这是我安装它的命令提示符,然后确认:

C:\Users\jason\Downloads>gacutil -i Rhino.Mocks.dll
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.21006.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

C:\Users\jason\Downloads>gacutil /l |grep -i rhino
Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL

This sounds related to this question, but they aren't the same thing. That question had no assemblies showing up. Mine has everything except the specific one I installed.

I'm hoping someone has a solution to this... am I doing something wrong? Or did I find some bug in VS?

I am using Visual Studio 2010 Professional Beta 2 on Windows 7 Ultimate. I just downloaded Rhino Mocks and decided to install it into the GAC using the command-line utility GACUTIL. I then rebooted.

Here you can see the assembly in my GAC (click to enlarge):

alt text

And here is the list of assemblies available to me in Visual Studio:

alt text

Here is the command prompt where I installed it, and then confirmed it:

C:\Users\jason\Downloads>gacutil -i Rhino.Mocks.dll
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.21006.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Assembly successfully added to the cache

C:\Users\jason\Downloads>gacutil /l |grep -i rhino
Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL

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

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

发布评论

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

评论(5

献世佛 2024-08-23 17:14:28

Visual Studio 从不列出 GAC 中的所有项目。它仅列出特定注册表项中注明的项目。

有关详细信息,请参阅此知识库文章:如何在“添加引用”对话框中显示程序集

您始终可以通过浏览磁盘上的程序集来添加对程序集的引用。

Visual Studio never lists all items in the GAC. It only lists items that are noted in a particular registry key.

Please see this knowledge base article for more info: How to display an assembly in the "Add Reference" dialog box

You can always add a reference to the assembly by browsing to it on disk.

执手闯天涯 2024-08-23 17:14:28

我创建了一个完全免费的工具,它将帮助您实现目标。 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.

神也荒唐 2024-08-23 17:14:28

Visual Studio“添加引用”对话框独立于 GAC:它查找程序集的文件夹实际上由 AssemblyFolders 注册表项控制。并非 GAC 中出现的所有内容都出现在“添加引用”中(相反,“添加引用”中并非所有内容都在 GAC 中)。

要添加对 Rhino Mocks DLL 的引用,只需转到“浏览”选项卡,导航到安装/解压缩/构建 Rhino Mocks 的位置,然后从那里选择 DLL。

The Visual Studio Add Reference dialog is independent of the GAC: the folders it looks in for assemblies is actually controlled by the AssemblyFolders registry key. Not everything that appears in the GAC appears in Add Reference (and conversely not everything in Add Reference is in the GAC).

To add references to the Rhino Mocks DLLs, just go to the Browse tab, navigate to the location where you installed/unzipped/built Rhino Mocks, and select the DLL(s) from there.

梦忆晨望 2024-08-23 17:14:28

您可以从 NuGet 安装 WebForms 和 WinForms 的报表查看器 DLL:

nuget> Install-Package Microsoft.ReportViewer

You can install the Report Viewer DLLs for both WebForms and WinForms from NuGet:

nuget> Install-Package Microsoft.ReportViewer
暖风昔人 2024-08-23 17:14:28

接受的答案没有解决这个问题,说明根据如何:添加略有更改或使用“添加引用”对话框删除引用

对于 32 位操作系统,请添加以下注册表项之一。

  • [HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"

对于 64 位操作系统,请在 32 位注册表配置单元中添加以下注册表项之一。

  • [HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\
    最小版本\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"

VersionMinimum 是适用的最低 .NET Framework 版本。如果 VersionMinimum 为 v3.0,则 AssemblyFoldersEx 中指定的文件夹适用于面向 .NET Framework 3.0 及更高版本的项目。

AssemblyLocation 是要在添加引用对话框中显示的程序集的目录,例如 C:\MyAssemblies。

在 HKEY_LOCAL_MACHINE 节点下创建注册表项允许所有用户在添加引用对话框中查看指定位置的程序集。在 HKEY_CURRENT_USER 节点下创建注册表项仅影响当前用户的设置。

再次打开添加引用对话框。程序集应显示在 .NET 选项卡上。如果没有,请确保程序集位于指定的 AssemblyLocation 目录中,重新启动 Visual Studio,然后重试。

已在 Windows 10 上测试并使用 Visual Studio 2017 Enterprise

Accepted answer didn't resolve this, instructions have changed slightly according to How to: Add or Remove References By Using the Add Reference Dialog Box

For a 32-bit operating system, add one of the following registry keys.

  • [HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"

For a 64-bit operating system, add one of the following registry keys in a 32-bit registry hive.

  • [HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\
    VersionMinimum\AssemblyFoldersEx\MyAssemblies]@="AssemblyLocation"

VersionMinimum is the lowest .NET Framework version that applies. If VersionMinimum is v3.0, folders specified in AssemblyFoldersEx apply to projects that target .NET Framework 3.0 and later.

AssemblyLocation is the directory of the assemblies that you want to appear in the Add Reference dialog box, for example, C:\MyAssemblies.

Creating the registry key under the HKEY_LOCAL_MACHINE node allows all users to see the assemblies in the specified location in the Add Reference dialog box. Creating the registry key under the HKEY_CURRENT_USER node affects only the setting for the current user.

Open the Add Reference dialog box again. The assemblies should appear on the .NET tab. If they do not, ensure that the assemblies are located in the specified AssemblyLocation directory, restart Visual Studio, and try again.

Tested and working with Visual Studio 2017 Enterprise on Windows 10

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