If you put an assembly in the GAC then the runtime will be able to find it *when you ask for it by name* wherever you application is running from on the local machine.
The assembly name is not, say, foo.dll but rather "foo, version=1.0.0.0, Culture=neutral, PublicKeyToken=aabbccddeeff11223344".
There are two ways to ask for an assembly by name: explicitly using Assembly.Load(); implicitly by setting up a reference in the applicaiton's manifest. The latter is done in Visual Studio by adding a reference to the assembly in the "References" in the solution view. It is done from the command line using the /r: compiler switch.
Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
Hi folks,
I was under the impression that once you had loaded an assembly into the
GAC, that you didn't have to make specific reference calls to the assembly
in another assembly. I was under the impression that this was the way you
extended the .net framework.
I've just done a little test a put a very basic assembly into my local GAC.
All well and good, but I can still only manually reference i.e. provide a
physical path and filename, the DLL to get to it's contents. So what
exactly does the GAC do if it doesn't serve as a central repository for ones
assemblies. I know it says it's there for when we want to share assemblies,
but how is this done when we still have to make a manual reference?
More to the point, if I am making manual references I'm still subject to the
same old cock up factor. Either I'm barking up the wrong tree or I'm
missing some sort of flag or declaration.
Paul Mason - 26 Nov 2004 16:12 GMT
Hi,
Have you or anyone else got any examples of Assembly.Load being used.
Having tried it, I can't find any reasonable friendly way of landing up with
a variable typed as a class within one of these assembly e.g.
dim objMyClass as object
objA = [Assembly].load("assembly name etc")
???
objMyClass = ????
???
objMyClass.MyMethod
From what I've seen you have to jump through hoops using the GetTypes
method. It looks like you land up with an object where you have to run the
lottery of late binding (something I avoid at all costs!).
Cheers...P
> If you put an assembly in the GAC then the runtime will be able to find it
> *when you ask for it by name* wherever you application is running from on
[quoted text clipped - 36 lines]
> same old cock up factor. Either I'm barking up the wrong tree or I'm
> missing some sort of flag or declaration.
Mattias Sj?gren - 26 Nov 2004 21:40 GMT
Paul,
>Having tried it, I can't find any reasonable friendly way of landing up with
>a variable typed as a class within one of these assembly
For that you need a compile time reference. Assembly.Load is used for
dynamicly loading assemblies.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.