Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
I've registered a DLL in GAC. But I want to know how can I use the DLL.
 

Don't ask me to create a assembly object at runtime and proceed. I just want to add it to my project reference.
 
Also I found a alternate of adding the dll to the C:\Windows\Microsoft.Net\Framework\v.x.x.x\
and it's working. But here the another problem is copying the dll to the above said path is working without registering the dll to GAC.
 

All I just need is a way to add the dll already added in the GAC as a reference to my new project.
 
Thanks in advance.
Posted 10-May-13 10:22am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

When the assembly (it's assembly, not "DLL"; for .NET, this is no more than a name of the modules of one of the assemblies) is placed in GAC, you should not reference it by assembly location. From this moment, you have to reference it by its strong name. With Visual Studio, you will find it by name in the ".NET" tab of the "Add Reference" window.
 
—SA
  Permalink  
Comments
chenthil28 at 10-May-13 16:02pm
   
I couldn't find in the Add Reference .Net Tab.
Kindly help.
Sergey Alexandrovich Kryukov at 10-May-13 16:10pm
   
Just use some patience and attention. How do you usually add references in Visual Studio. You always use the window "Add References". From a context menu of the Solution Explorer node "References". I don't understand you: if you did not add references before, why would you develop anything for GAC, and, most strangely, how? Hope this is just some minor misunderstanding.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You must first understand why you want to place an assembly to the GAC at all: the GAC holds strong named signed assemblies of various versions. Each .NET executable looks up *at runtime* the directly or indirectly referenced assemblies in a well defined sequence, at one point also in the GAC. See How the Runtime Locates Assemblies[^].
 
When it is about *developing* such applications that depend on other assemblies, you can, but do not need to reference it from the GAC *at development time*. The reference is only used to first have access to the functionality exposed by the referenced assembly and secondly, to compile in the respective strong name into your application assembly. You may now have that assembly located in some persistent location (e.g. somewhere in ProgramFiles), then have it once registered in the GAC (running once as administrator: gacutil /i ...) and finally refer to the ProgramFiles assembly in your VS2010.
 
Note: the VS2010 does *not* compile in any path to an assembly. Neither do all the references in your project get their way into the assembly - only the really needed ones get compiled into the application.
 
E.g. if you run ildasm /text myApp.exe | more, and look for .extern, you see which assemblies with what version, etc. are referenced. No path there, only the name, version, culture, public token.
 
Cheers
Andi
  Permalink  
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You should NEVER place anything in the C:\Windows\Microsoft.NET folders. They are strictly for the .NET Framework. It you have a shared library that's used by more than one application, then you can sign it and put it in the GAC or some other place as your requirements dictates, but NEVER under C:\Windows\Microsoft.NET.
  Permalink  
Comments
Andreas Gieriet at 10-May-13 16:57pm
   
My 5!
Cheers
Andi

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 245
1 Kamal Rocks 184
2 Sergey Alexandrovich Kryukov 175
3 BillWoodruff 173
4 PIEBALDconsult 160
0 OriginalGriff 5,655
1 DamithSL 4,506
2 Maciej Los 3,997
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 10 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100