.NET 4.0 有一个新的 GAC,为什么? [英] .NET 4.0 has a new GAC, why?

查看:32
本文介绍了.NET 4.0 有一个新的 GAC,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

%windir%Microsoft.NETassembly 是新的 GAC.这是否意味着现在我们必须管理两个 GAC,一个用于 .NET 2.0-3.5 应用程序,另一个用于 .NET 4.0 应用程序?

%windir%Microsoft.NETassembly is the new GAC. Does it mean now we have to manage two GACs, one for .NET 2.0-3.5 applications and the other for .NET 4.0 applications?

问题是,为什么?

推荐答案

是的,因为有 2 个不同的全局程序集缓存 (GAC),您必须单独管理它们.

Yes since there are 2 distinct Global Assembly Cache (GAC), you will have to manage each of them individually.

在 .NET Framework 4.0 中,GAC 经历了一些更改.GAC 一分为二,每个 CLR 一个.

In .NET Framework 4.0, the GAC went through a few changes. The GAC was split into two, one for each CLR.

用于 .NET Framework 2.0 和 .NET Framework 3.5 的 CLR 版本是 CLR 2.0.在前两个框架​​版本中没有必要拆分 GAC.在 Net Framework 4.0 中破坏旧应用程序的问题.

The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. There was no need in the previous two framework releases to split GAC. The problem of breaking older applications in Net Framework 4.0.

为了避免 CLR 2.0 和 CLR 4.0 之间的问题,现在 GAC 被拆分为每个运行时的私有 GAC.主要变化是 CLR v2.0 应用程序现在无法在 GAC 中看到 CLR v4.0 程序集.

To avoid issues between CLR 2.0 and CLR 4.0 , the GAC is now split into private GAC’s for each runtime.The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC.

来源

为什么?

这似乎是因为 .NET 4.0 中有 CLR 更改,但 2.0 到 3.5 中没有.1.1 到 2.0 CLR 也发生了同样的事情.似乎GAC 有能力存储不同版本的程序集,只要它们来自同一个CLR.他们不想破坏旧的应用程序.

It seems to be because there was a CLR change in .NET 4.0 but not in 2.0 to 3.5. The same thing happened with 1.1 to 2.0 CLR. It seems that the GAC has the ability to store different versions of assemblies as long as they are from the same CLR. They do not want to break old applications.

请参阅 MSDN 中有关 4.0 中 GAC 更改的以下信息.

例如,如果 .NET 1.1 和 .NET 2.0 共享相同的 GAC,那么从该共享 GAC 加载程序集的 .NET 1.1 应用程序可以获得 .NET 2.0 程序集,从而破坏 .NET 1.1 应用程序

For example, if both .NET 1.1 and .NET 2.0 shared the same GAC, then a .NET 1.1 application, loading an assembly from this shared GAC, could get .NET 2.0 assemblies, thereby breaking the .NET 1.1 application

用于 .NET 的 CLR 版本框架 2.0 和 .NET 框架 3.5是 CLR 2.0.结果,有前两个不需要框架发布以拆分 GAC.破旧的问题(在这个案例,.NET 2.0) 应用程序在 Net Framework 4.0 中重新出现在哪一点 CLR 4.0 发布了.因此,避免之间的干扰问题CLR 2.0 和 CLR 4.0,GAC 现在是拆分为每个私人 GAC运行时.

The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. As a result of this, there was no need in the previous two framework releases to split the GAC. The problem of breaking older (in this case, .NET 2.0) applications resurfaces in Net Framework 4.0 at which point CLR 4.0 released. Hence, to avoid interference issues between CLR 2.0 and CLR 4.0, the GAC is now split into private GACs for each runtime.

随着 CLR 在未来版本中的更新,您可以期待同样的事情.如果只是语言发生变化,那么您可以使用相同的 GAC.

As the CLR is updated in future versions you can expect the same thing. If only the language changes then you can use the same GAC.

这篇关于.NET 4.0 有一个新的 GAC,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆