How to see your GAC-assemblies in the "add reference" dialog

IMHO it's a pity that you don't see every GAC-installed assembly when you do "add reference" from Visual Studio, and I couldn't find much information in the VS documentation about this. So I Googled around a bit and found these ways (I haven't tried them yet):

  • Put a copy of your assembly in C:\WINNT\Microsoft.NET\Framework\v1.0.3705  or  C:\WINNT\Microsoft.NET\Framework\v1.1.4322 or wherever your framework is installed
  • Add a new registry key under one of the following registry paths with a default value that points at the location of your assemblies.:
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders  (I found WSE, NUnit and the Primary Interop Assemblies here).
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AssemblyFolders (this is for VS.NET 2003 I think)
    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\AssemblyFolders (this is for VS.NET 2002 I think)
  • Put a copy of the assembly in the directory C:\Program Files\Microsoft Visual Studio\Common7\IDE\PublicAssemblies or, if you got VS.NET 2003, in the C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\PublicAssemblies directory.

I'm not sure yet, what the best choice is. According to the readme-file in the PublicAssemblies-directory:

"The PublicAssemblies folder is designed to contain managed assemblies that run within the development environment and are typically called from macros, add-ins, and other user code. The assemblies in this directory are displayed in the Project Add References dialog box and the Object Browser's Component Selector dialog box. For example, COM interoperability wrappers for automation object models (e.g. vslangproj.dll) should be installed in the PublicAssemblies folder."

I'll try the different options and see what happens, but I think I prefer to put my assemblies into a directory of my own, like C:\MyGACFiles\ and then add a "MyGACFiles" key to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders section.

Anyone with good experience with this? Is it changed in Whidbey so that you get a list of GAC-ed assemblies in the "add reference" dialog?

Published Tuesday, December 16, 2003 4:44 PM by jdanforth

Comments

# re: How to see your GAC-assemblies in the "add reference" dialog

Tuesday, December 16, 2003 11:07 AM by Matt Hawley
If you place a key at HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\.NETFRAMEWORK\ASSEMBLIES\[MANUFACTURER]

VS.NET 2002 & 2003 will pick up your assembly.

# re: How to see your GAC-assemblies in the "add reference" dialog

Tuesday, December 16, 2003 11:12 AM by Adam Weigert
That's funny ... I just taught a quick lesson on how to create developer-oriented setup packages and spent 10 minutes looking how to do this ... you must have been typing this at the same time i was teaching it ... weird :)

# re: How to see your GAC-assemblies in the "add reference" dialog

Tuesday, December 16, 2003 12:11 PM by Robert McLaws
Actually, that's not the proper way to use the registry. Read this blog entry for more information.

http://weblogs.asp.net/rmclaws/posts/37743.aspx

# re: How to see your GAC-assemblies in the "add reference" dialog

Tuesday, December 16, 2003 12:49 PM by Johan Danforth
Matt: I've not seen that key before (using "assemblies" as sub-key).

Adam: The world is a weird place... ;)

Robert: Good idea to add the version data to the registry key. Thanks.

# re: How to see your GAC-assemblies in the "add reference" dialog

Tuesday, December 16, 2003 1:23 PM by Nomad
Robert, I agree about having a good structure in the registry, but can give some more detail about "the proper way to use the registry", maybe with links to authoritative sources?

Not just this:
"The point of all this is not to tell you that my way is the only right way of doing things, or that I think I'm a genius or the smartest guy in the world for coming up with it."

# re: How to see your GAC-assemblies in the "add reference" dialog

Tuesday, December 16, 2003 1:41 PM by Johan Danforth
Do a search on MSDN for "AssemblyFolders" and see what you got... not much I can tell you. There is a small article by Izzy Gryko from the Visual Studio Team about how to "support multiple versions of the same component on a single machine in Visual Studio .NET 2003". It has a few good parts, but it doesn't say much about "the proper way" to use the registry.

# re: How to see your GAC-assemblies in the "add reference" dialog

Saturday, March 13, 2004 9:35 AM by Adriano Ferreira
Hi.
I founded an article on the Microsoft Web Site
Here is te link, http://support.microsoft.com/default.aspx?scid=kb;en-us;306149

This may help.
Best Regards.

# re: How to see your GAC-assemblies in the "add reference" dialog

Sunday, March 14, 2004 6:53 AM by Boris
Your solution may work in a case that you created some assembly and registered in in GAC. I needed to use an assembly that was installed in the GAC, but I had no idea where it's DLL file reside. Fortunately, I had a sample project with these references. So I opened the project file in a text editor and copied the required references. It seems to be easier than dealing with registry.

Regards,
Boris

# Adding Assemblies to 'Add Reference'

Wednesday, October 20, 2004 3:03 PM by TrackBack
If you want to add assemblies to the 'Add Reference' dialog in Visual Studio .NET, and your assemblies don't already have homes, use Andrew Troelsen's method. If your assemblies already have homes, though, use this method to add them wherever...

# Remote Development, Deployment, and Remote Debugging your first SharePoint 2007 Program « Stuff I geek with

Pingback from  Remote Development, Deployment, and Remote Debugging your first SharePoint 2007 Program « Stuff I geek with

# Techno Blog » Archive » Añadir assemblies a Visual Studio

Tuesday, December 01, 2009 1:00 PM by Techno Blog » Archive » Añadir assemblies a Visual Studio

Pingback from  Techno Blog  » Archive   » Añadir assemblies a Visual Studio