和最重要的是,是否有情况下,人们必须使用全局程序集缓存或其中一个不能用呢?
And on top of that, are there cases where one has to use the global assembly cache or where one cannot use it?
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.
所以,要总结这一切,从简单的开始,如果你在后面看到的主要的性能提升,如果你把你的程序集到GAC和NGEN他们,去为它,否则不要打扰。 GAC是更适合的框架那里是期望的库中之间更多的应用程序共享,在99%的情况下,你不需要它。
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.