5

When working with Visual Studio and adding a reference to a project you are presented a window with multiple tabs; .NET, Project, Recent, and Browse. What is needed to get an item listed under the .NET listing?

We have items in the GAC which we thought would get them listed there, but they are not. We are looking for methods to be able to get more consistent reference paths for assemblies in our applications across a very large development team.

Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173

4 Answers4

8

You need to make a registry entry to tell Visual Studio which folders to show assemblies for. This article explains how to do it:

http://www.platinumbay.com/blogs/dotneticated/archive/2008/09/02/add-reference-and-the-gac.aspx

We don't use the GAC anymore as it is a cumbersome process that wasn't giving benefit to our team members. We solve the consistent path issues using project references for our own assemblies. Third party assemblies go in a folder within the solution and we reference the assemblies in the projects from there. This way everyone has them in the same path with no worries.

Jim Petkus
  • 4,500
  • 25
  • 19
  • Thanks for the link! I would love to get away from GAC....but the employer will not let us :( – Mitchel Sellers Jan 31 '09 at 08:57
  • I had the same problem where I worked, but after we got past the initial resistance and actually tried going without everyone was pleased with how much more simple the environment became to maintain. I think this affinity that they had to the GAC is a holdover from the COM days. – Jim Petkus Jan 31 '09 at 14:04
  • The GAC is useful for a limited purpose, but often overused. – Cheeso May 16 '09 at 13:56
  • Couple of comments 1. Check for the 64 bit registry hive (HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\) 2. If you want the assembly to be listed for a specific version of .NET framework put it under (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\[version]\AssemblyFoldersEx) – Soundararajan Jan 25 '13 at 10:24
5

You need to add a registry key like:

[HKEY_CURRENT_USER\SOFTWARE\Microsoft.NETFramework\AssemblyFolders\MyAssemblies]@="C:\MyAssemblies"

You can see more on this at: http://support.microsoft.com/kb/306149

Wolfwyrd
  • 15,716
  • 5
  • 47
  • 67
1

This is probably a VFAQ, even though I'm quite new here. The basic concept here is that the list of assemblies is loaded based on a setting in the Registry.

All you need to do is to add a registry subkey which points to the location of the assembly under the following key:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\

If MyAssemblyFolder is the name of your folder where your Assembly to be added resides, create a subkey with any name and within it, add a String key with the complete path to your MyAssemblyFolder.

Cerebrus
  • 25,615
  • 8
  • 56
  • 70
0

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.

Regards,

Muse VSExtensions

BALKANGraph
  • 2,031
  • 1
  • 15
  • 16