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 registry 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 registry keys:
- [HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoft.NETFrameworkAssemblyFolders]
- [HKEY_CURRENT_USERSOFTWAREWow6432NodeMicrosoft.NETFrameworkAssemblyFolders]
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 extra 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 registry 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.
As part of his fantastic ‘What is .NET standard‘ presentation at DDD12, Adam Ralph provided an amazing amount of detail in such a short amount of time. One of the most valuable points, which is completely obvious when you think about it, is how you should work with .NET standard when creating libraries. NET standard now comes in a multitude of flavours: currently 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 and 2.0. When starting out . . .
If you’re trying to access a class library (.NET Standard) from a traditional console application (in VS2017 those can be found under ‘Windows Classic Desktop’) you will run into problems; which can feel a little strange for something that was pretty simple in VS2015 and earlier. You can add a reference to the class library project (Resharper will even volunteer to add the dependency / namespace reference if you don’t already have it). But the . . .
MUSE.VSExtensions works like a charm