John Lam 1997 — 2026

Whither the GAC?

I see that Ted Neward has been writing about the GAC. In particular, Ted writes “One uses the GAC to put assemblies into place that should be shared across applications”.

I disagree. The only reason to put your assembly into the GAC is if you take the following oath: “I promise to NEVER EVER make any breaking changes in future versions of this assembly.” This is the oath that MS took when it created mscorlib.dll and friends. And MS devotes a tremendous amount of time, energy and ultimately money to make those kinds of guarantees. And even MS has to make breaking changes occasionally.

Most folks don’t take that oath. Therefore I would argue that assemblies like Genghis do not belong in the GAC. They should be shipped as private assemblies instead.

4 archived reader comments

Jon Flanders (2004-03-31)

So do you recommend putting a custom control dll into two or more bin directories if it needs to be used accross multiple web applications?

John Lam (2004-03-31)

I would still recommend avoiding the GAC in this case. If those applications need to evolve independently of each other, you will eventually run into a situation where that control needs to evolve with one of those apps, yet the other app remains unchanged. If you’re not careful, you could introduce a breaking change into the control that breaks the unmodified app. It’s just safer (and simpler) to deploy a separate copy of the assembly with each application.

Rob Streno (2004-03-31)

John:

While (I think) I agree with you for commercial applications, when you have control over the environment, GAC can be a lifesaver. As a f’rinstance:

We have a series of base class DLLs and architecture service DLLs that are used by about 120 different web services. From a deployment standpoint, we have a “framework deployment” MSI, and a “web service deployment MSI.” Everything is strongly named with an auto-increment version number, so when we get to production we *know* that there aren’t going to be any broken interfaces. We find that out long before, if it happens.

For end-user applications where you don’t have control over the workstation, your opinion looks like it makes a lot of sense.

-Rob Streno

Jon Flanders (2004-03-31)

Well John - I think you are just wrong :) What if you have an important bug fix and you have 5 web application that all use the same assembly? You have to recompile and replace 5 dlls? It is kind of like copy-and-past inheritence to me. That’s a really bad way to share code IMO, which introduces way more problems than the GAC does.

I think your issue about not-breaking the interface holds true *until* you change the version number. Once you change the version number (in spite of binding redirects and publishier policies) I think it is fine to introduce changes that might break apps compiled against v1, because they should be recompiled and re-tested against v2.