Assembly installed into the GAC not showing up in Visual Studio
Asked Answered
S

5

29

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
Stolid answered 1/1, 2010 at 1:49 Comment(1)
BTW this issue is unlikely to be related to the issue you link to. That guy's VS installation just seems totally messed up.Flection
F
40

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.

Flection answered 1/1, 2010 at 1:53 Comment(2)
i have a sample.dll placed in pathCode and install it into GAC pathGac, when add registry key which path i will choose ??? and if i choose pathCode any project referenced to item appeared in add reference dialog will worked from gac normally ? ThanksNeolatin
The link is now broken, but also: adding something from the GAC is different than adding something by path. If you add a reference by browsing to it, the file path itself is hardcoded into the applicationCardboard
B
16

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.

Banquette answered 29/4, 2010 at 9:36 Comment(3)
+1 awesome tool, now I don't have to worry about the registry I can just add directly from GACVehement
Do you have this tool for VS2012?Catheycathi
@bunggo: I have unofficially modified the extension to support VS2012 and VS2013. It is available for download hereSplanchnology
L
5

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.

Lot answered 1/1, 2010 at 1:54 Comment(0)
P
0

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

nuget> Install-Package Microsoft.ReportViewer
Peccable answered 24/8, 2015 at 14:55 Comment(0)
K
0

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

Kaliope answered 21/3, 2017 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.