Question

I created a homemade assembly and I think I installed it correctly in the GAC using the .Net 2.0 configuration tool (mscorcfg.msu) However, when I want to reference it in visual studio, where do I find it?

( I know, I should not use the GAC anyway, but indulge me ;-))

EDIT: I did not ask the question clear enough: After installing the assembly to the GAC, it does not show up on the .NET tab of the Project-Add Reference menu.

Was it helpful?

Solution

The add reference dialog actually looks at the registry, in particular:

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

To add your assembly, you must edit these registry keys. Or simply using the "Browse..." button (instead) may be more tempting.

OTHER TIPS

When you need to reference an assembly that has been deployed to the GAC, you will need to browse to the \bin\Debug directory of the original project via the Browse tab of the Add Reference dialog in Visual Studio.

The reason this works is that since you've installed the assembly into the GAC, it will have a strong name and therefore a .publickey value in the manifest.

When you reference an assembly whose manifest contains a .publickey value, Visual Studio assumes the strongly named assembly will most likely be deployed to the GAC, and therefore does not bother to copy the binary to your application folder.

Instead, it will use the version in the GAC.

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.

Hope this hekps,

Muse VSExtensions

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top