Search

Referencing DLL from GAC in Visual Studio

Long back i wrote about it http://www.killercodes.in/2010/09/how-to-reference-assemblies-in-gac.html but this requires some registry editing and generally developers don't have privileges to do that in the production system. I too face the similar issue and i found that the GAC for .Net framework resides at

"C:\Windows\assembly\"
. So the first thing is to put your DLL there. Then

  • GoTo Projects --> Properties

  • Click Reference Path and browse the GAC folder(for 3.5 it's "C:\Windows\assembly\")


Now remove any of the local references that can conflict with the GAC version of DLL and Buld.

Why it works beacuse during the build Visaul studio will try to resolve the references and since we have specified a reference path to the Framework 3.5 GAC folder, it will resolve the reference by taking it from the GAC folder and since the folder structure remains same across windows system there will be no errors.



although i have tested it with framework 3.5 but it will work with any other framwork also.
..keep coding