GAC

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

hi guys

I've ready many books to find out about GAC but all books mention gacutil
but only go as far as gacutil /i and /u

here's a silly question how do I USE the assembly after its installed to GAC
? ie. call on the assembly's functions etc.

Thanks
Tom
 
The GAC is simply a deployment option (of which there are many). You normally build your application referencing other assemblies so you can use their functionality and the compiler generates external assembly references in your application assembly's manifest.

At runtime, the assembly resolver takes the information in the manifest and attempts to convert that information (the external assembly's name) to a physical location to load the assembly from (the CODEBASE). The first place the assembly resolver will look is the GAC.

If you want to late bind to types in the GAC;d assembly, you need to use the Assembly.Load method passing in the fully qualified name of the GAC'd assembly - e.g.

Assembly a = Assembly.Load("Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=aabbccddeeffaa11");
Bar b = (Bar)a.CreateInstance("Bar");

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

hi guys

I've ready many books to find out about GAC but all books mention gacutil
but only go as far as gacutil /i and /u

here's a silly question how do I USE the assembly after its installed to GAC
? ie. call on the assembly's functions etc.

Thanks
Tom
 
here's a silly question how do I USE the assembly after its installed to GAC
? ie. call on the assembly's functions etc.

Same way as for assemblies that haven't been installed into the GAC.
You reference a copy of the assembly (not the one in the GAC) and go
from there.



Mattias
 
Back
Top