What are the advantages and disadvantages of using the GAC?

  • Loading assemblies from GAC mean less overhead and security that your application will always load correct version of .NET library
  • You shouldn’t ngen assemblies that are outside of GAC, because there will be almost no performance gain, in many cases even loss in performance.
  • You’re already using GAC, because all standard .NET assemblies are actually in GAC and ngened (during installation).
  • Using GAC for your own libraries adds complexity into deployment, I would try to avoid it at all costs.
  • Your users need to be logged as administrators during installation if you want to put something into GAC, quite a problem for many types of applications.

So to sum it all, start simple and if you later see major performance gains if you put your assemblies into GAC and NGEN them, go for it, otherwise don’t bother. GAC is more suitable for frameworks where there is expectation for library to be shared among more applications, in 99% of cases, you don’t need it.

Leave a Comment