Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference an assembly in GAC

I'm trying to deploy an assembly in GAC, I did that successfully using Gacutil.exe utility.

Now, when I try to add a reference for it from Visual Studio - Add Reference - .Net tab, I don't find it!!

Any help!

like image 506
Homam Avatar asked Feb 16 '11 13:02

Homam


2 Answers

I had this problem, the GAC'ed dlls arent included in the references.

Check out this post I made: Add Reference in Framework 4 Application is not showing assemblies in GAC registered with GACUtil V 4

To make things easier, the link to the msdn article: http://msdn.microsoft.com/en-us/library/wkze6zky(VS.100).aspx

And to paraphrase, create an entry along the lines of the following: [HKEY_CURRENT_USER\SOFTWARE\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\MyMagicAssemblies] and then set the (Default) value to be a string with the value being the path you want searched. Look at your registry for examples of how this is set up (so the default value becomes: c:\dlls\

v4.0.30319 would be replaced with the framework version you want the dlls to show up against.

because your dlls are in the GAC it will use those as the actual reference and not the files you are showing in the reference list. Only if the version number of the dlls are different will it use your local version.

like image 99
Luke Duddridge Avatar answered Sep 28 '22 06:09

Luke Duddridge


I've created a sexy visual studio extension 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.

enter image description here

Regards...

Muse Extensions

like image 20
BALKANGraph Avatar answered Sep 28 '22 05:09

BALKANGraph