Thursday, 27 January 2011

Accessing GAC DLL's in Visual Studio 2010 "Find References"

Or better titled I've just registered my DLL in the GAC, why does it not appear in Visual Studio's "Find Reference" dialog.

It's probably the first thing people notice after they've started using the GAC for the first time. You've managed to register your DLL and you've confirmed it is in the GAC, but it just won't appear in Visual Studio's "Add Reference" dialog box.   As it turns out, for what were probably good reasons, the visual studio team decided to use the registery to hold the list of DLLs that appear in the "Add Reference" dialog box.

You have two options, the first is to manually edit the registry - adding your DLL to the following registery keys:

  • [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\AssemblyFolders]
  • [HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\AssemblyFolders]

Another option is to install the Visual Studio extension MUSE.VSExtensions, which adds an extra option to the context sensitive menu when you right mouse click on "References".  The exta option is "Add GAC Reference" which pops up a new dialog box listing all the items currently held in the GAC - no messing around in the registery each time you add something new to the GAC.  It is worth noting that the search is case sensitive.

See Adding a DLL to the GAC in .NET 4.0 for more information on adding DLL's to the GAC in .NET 4.0 and differences between this and earlier versions of the framework.

1 comment:

jan iordanov said...

MUSE.VSExtensions works like a charm

Post a Comment