473,378 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

To GAC or not to GAC, that is the question

During building of one of my applications for deployment it occurred to me
that I was using a common assembly, that most of our future applications
will be using. So I started to wonder if the assembly shouldn't be placed
into the GAC.

I currently have the task of deciding if our common assemblies should reside
in the GAC or should we deploy the assemblies with the application and have
them reside in the application directory. Or some combination of both
depending on the situation, with knowing that if assembly A goes in the GAC
it always goes into the GAC, and if assembly B is private it will always be
private.

What I would like to get as a response is other peoples experience with the
GAC, why to use it and why not to use it. I understand how it works in
theory, but experience is a much better teacher than theory.
Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
Jul 21 '05 #1
6 2261
Since you will have multiple applications using the same DLL, the GAC would
be the right place for it.

Annoyances with the GAC are things like having to strong name your
assembly - which then means recompiling anything that uses the dll when the
version changes. You also might run into issues with multiple version of the
same DLL being in the GAC, and figuring out which one your app is trying to
use, etc.

So in situations when the DLL will only be used by one app, it is overkill
to place it in the GAC. However, in your situation it is probably worth it,
so you don't have multiple copies of your dll floating around the machine.

"Wayne" <Me******@community.nospam> wrote in message
news:OP****************@tk2msftngp13.phx.gbl...
During building of one of my applications for deployment it occurred to me
that I was using a common assembly, that most of our future applications
will be using. So I started to wonder if the assembly shouldn't be placed
into the GAC.

I currently have the task of deciding if our common assemblies should reside in the GAC or should we deploy the assemblies with the application and have them reside in the application directory. Or some combination of both
depending on the situation, with knowing that if assembly A goes in the GAC it always goes into the GAC, and if assembly B is private it will always be private.

What I would like to get as a response is other peoples experience with the GAC, why to use it and why not to use it. I understand how it works in
theory, but experience is a much better teacher than theory.
Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

Jul 21 '05 #2

"Marina" <so*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Since you will have multiple applications using the same DLL, the GAC
would
be the right place for it.
I don't agree that this is a hard rule. Having multiple copiues of a DLL
"floating around on the machine" may be *just* what you want. Disk space is
cheap. Maintaining complete and total independence between two applications
is also valuable. The simplicity of private assemblies is also nice.

Imagine a scenario where you have 2 apps, both using "the same DLL".
Except the 2 apps get updated and re-deployed at different, independent
intervals. Would you want to run the risk of an update of App A causing
changes in behavior in App B, based on a shared GAC'd DLL, just to save
200kb of disk space? Oh, you're going to rev the version number of the
GAC'd assembly, you say? Then why GAC it in the first place?? If each app
gets its own version, then there is no benefit to the GAC, and there is a
big management cost.

In general, people tend to over-use the GAC. My advice is to Keep it
simple. Avoid the GAC unless you really really need it.

http://www.gotdotnet.com/team/clr/wh...e_the_gac.aspx

-Dino
Annoyances with the GAC are things like having to strong name your
assembly - which then means recompiling anything that uses the dll when
the
version changes. You also might run into issues with multiple version of
the
same DLL being in the GAC, and figuring out which one your app is trying
to
use, etc.

So in situations when the DLL will only be used by one app, it is overkill
to place it in the GAC. However, in your situation it is probably worth
it,
so you don't have multiple copies of your dll floating around the machine.

"Wayne" <Me******@community.nospam> wrote in message
news:OP****************@tk2msftngp13.phx.gbl...
During building of one of my applications for deployment it occurred to
me
that I was using a common assembly, that most of our future applications
will be using. So I started to wonder if the assembly shouldn't be placed
into the GAC.

I currently have the task of deciding if our common assemblies should

reside
in the GAC or should we deploy the assemblies with the application and

have
them reside in the application directory. Or some combination of both
depending on the situation, with knowing that if assembly A goes in the

GAC
it always goes into the GAC, and if assembly B is private it will always

be
private.

What I would like to get as a response is other peoples experience with

the
GAC, why to use it and why not to use it. I understand how it works in
theory, but experience is a much better teacher than theory.
Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a minute.

But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein


Jul 21 '05 #3
Marina wrote:

<snip>

Annoyances with the GAC are things like having to strong name your
assembly - which then means recompiling anything that uses the dll when the
version changes.


Isn't this handled through publisher policies?

--
Willem van Rumpt
Jul 21 '05 #4
Well, theoretically, if you updated your DLL, you would want it to available
to all the apps that use it. If this is so, now you have to go searching
for all instance of this DLL on the machine, and find all of your apps, and
update each one of these - instead of just updating it in the GAC and being
done with it.
It really depends on the situation you are in.

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:OW**************@TK2MSFTNGP14.phx.gbl...

"Marina" <so*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Since you will have multiple applications using the same DLL, the GAC
would
be the right place for it.
I don't agree that this is a hard rule. Having multiple copiues of a DLL
"floating around on the machine" may be *just* what you want. Disk space

is cheap. Maintaining complete and total independence between two applications is also valuable. The simplicity of private assemblies is also nice.

Imagine a scenario where you have 2 apps, both using "the same DLL".
Except the 2 apps get updated and re-deployed at different, independent
intervals. Would you want to run the risk of an update of App A causing
changes in behavior in App B, based on a shared GAC'd DLL, just to save
200kb of disk space? Oh, you're going to rev the version number of the
GAC'd assembly, you say? Then why GAC it in the first place?? If each app gets its own version, then there is no benefit to the GAC, and there is a
big management cost.

In general, people tend to over-use the GAC. My advice is to Keep it
simple. Avoid the GAC unless you really really need it.

http://www.gotdotnet.com/team/clr/wh...e_the_gac.aspx

-Dino
Annoyances with the GAC are things like having to strong name your
assembly - which then means recompiling anything that uses the dll when
the
version changes. You also might run into issues with multiple version of
the
same DLL being in the GAC, and figuring out which one your app is trying
to
use, etc.

So in situations when the DLL will only be used by one app, it is overkill to place it in the GAC. However, in your situation it is probably worth
it,
so you don't have multiple copies of your dll floating around the machine.
"Wayne" <Me******@community.nospam> wrote in message
news:OP****************@tk2msftngp13.phx.gbl...
During building of one of my applications for deployment it occurred to
me
that I was using a common assembly, that most of our future applications will be using. So I started to wonder if the assembly shouldn't be placed into the GAC.

I currently have the task of deciding if our common assemblies should

reside
in the GAC or should we deploy the assemblies with the application and

have
them reside in the application directory. Or some combination of both
depending on the situation, with knowing that if assembly A goes in the

GAC
it always goes into the GAC, and if assembly B is private it will
always be
private.

What I would like to get as a response is other peoples experience with

the
GAC, why to use it and why not to use it. I understand how it works in
theory, but experience is a much better teacher than theory.
Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a
minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein



Jul 21 '05 #5
I guess it can be, now there is another level of complexity and another
thing you have to do to make the transition to the new version - and another
opportunity for something to go wrong and not work.

"Willem van Rumpt" <no***********@no.thelandslide.spam.com> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
Marina wrote:

<snip>

Annoyances with the GAC are things like having to strong name your
assembly - which then means recompiling anything that uses the dll when the version changes.


Isn't this handled through publisher policies?

--
Willem van Rumpt

Jul 21 '05 #6
I tend to side with Dino - don't use the GAC unless you need to. You should
consider the following:

How are your assemblies installed?
What versioning policy will you use?
How will the assemblies be updated?
How do you plan to use Publisher Policy?
Is the assembly really shared amongst many different, unrelated
applications?
How will the assembly evolve? Once you put it into the GAC you may be stuck
with it living there. If you leave it private now you will always have the
option of putting into the GAC in the future.

One problem with using the GAC are that you cannot xcopy deploy your
assemblies - a special routine to install the assembly into the GAC is
needed. Another potential problem is that if you update the assembly in the
GAC and force all applications to use it you run the risk of breaking a
working application.

Hard disk space is cheap - avoiding unnecessary duplication is not a valid
reason to install into the GAC.

Bottom line for me - the GAC has the feel to me of the NT registry - it was
originally touted as the best place to store all app-specific data, but in
practice it turned out to be a nightmare and led to DLL hell. I think there
will be a tendency to put all sorts of assemblies into the GAC that have no
business being there. IMO only system level shared assemblies that undergo
rigorous regression testing for backwards compatibility should go there
unless there's a darn good reason for ignoring that constraint.

Dave

"Wayne" <Me******@community.nospam> wrote in message
news:OP****************@tk2msftngp13.phx.gbl...
During building of one of my applications for deployment it occurred to me
that I was using a common assembly, that most of our future applications
will be using. So I started to wonder if the assembly shouldn't be placed
into the GAC.

I currently have the task of deciding if our common assemblies should
reside
in the GAC or should we deploy the assemblies with the application and
have
them reside in the application directory. Or some combination of both
depending on the situation, with knowing that if assembly A goes in the
GAC
it always goes into the GAC, and if assembly B is private it will always
be
private.

What I would like to get as a response is other peoples experience with
the
GAC, why to use it and why not to use it. I understand how it works in
theory, but experience is a much better teacher than theory.
Thanks
Wayne Sepega
Jacksonville, Fl

"When a man sits with a pretty girl for an hour, it seems like a minute.
But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mohammed Mazid | last post by:
Can anyone please help me on how to move to the next and previous question? Here is a snippet of my code: Private Sub cmdNext_Click() End Sub Private Sub cmdPrevious_Click() showrecord
3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
3
by: Zhang Weiwu | last post by:
Hello! I wrote this: ..required-question p:after { content: "*"; } Corresponding HTML: <div class="required-question"><p>Question Text</p><input /></div> <div...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.