When do I use shared assemblies that is using GAC

T

tony

Hello!

Can somebody tell me exactly when do I use GAC where shared assembly dll is
stored.

//Tony
 
K

Kevin Spencer

Define "use". The CLR is in the GAC, so any time you're using a platform
class, you're using the GAC.

Shared assemblies can be stored anywhere. Many of them are stored in
subfolders under the \Windows\assembly folder, folders which are invisible,
even if you allow hidden and system files to be viewed. The only time I've
seen them is when uninstalling the Framework.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
J

Jianwei Sun

I think the recommended way is "unless you absolutely needed to share
that assembly (like .Net framework assembly) across a lot of
applications. you really shouldn't do that..

A good way to share your assembly is :

Under :
Program Files\Your Application\

YourFirstApplication.exe
YourSecondApplication.exe

Then you create an folder called SharedAssembly under the folder (
Program Files\Your Application\SharedAssembly) and put your all the
shared assemblies there.

HTH..
 
K

Kevin Spencer

Generally, it is not adviseable to do so.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
G

Guest

You should put your assembly in GAC ie. you should make your assemblies
shared only when if more than one applications need to use it. Otherwise, it
is better to have the assemblies as private only.
 
G

Guest

I wonder if the shared assemblies must be under "Program Files" folder.
Could it be in different folder ?

Thanks,
Eric.-
 
B

Bruce Wood

ericms said:
I wonder if the shared assemblies must be under "Program Files" folder.
Could it be in different folder ?

We just copy the assembly into the same folder as the application
(.exe) file. If there are several applications in the same folder then
they can share DLLs.

There is no requirement that they be under "Program Files" unless that
is where you keep your .exes. You can look up articles on exactly how
the CLR searches for assemblies:

http://msdn2.microsoft.com/en-us/library/yx7xezcf.aspx

We do not use the GAC. The GAC is _necessary_ only if you need to
support side-by-side versioning. That is, only if you need multiple
versions of the same assembly loaded on your system at one time. Even
then, you could do this manually by simply keeping your applications in
separate folders and deploying the correct version of the DLL to the
relevant folder.

The GAC is there for commercial software developers who want control
over versioning. For those of us who do software development for
strictly in-house consumption, it's optional.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top