为什么框架 dll 在多个地方重复?
安装.Net 4并得到一些已经在此处解答的问题后,我还意识到框架dll是如何在多个地方重复的不同的 Framework 版本(这不是新问题,以前的版本也会出现这种情况,但直到现在才注意到)
1 - GAC:%systemroot%\ assembly
2- Framework 安装目录:%systemroot%\Microsoft.NET\Framework \v...
3-如果您安装了 Windows SDK,也在:C:\Program Files\Microsoft SDKs\Windows\
我认为最后一个是所谓的“参考组件”,并且有额外的元数据来帮助视觉工作室,但是
2 号位置呢?为什么在那里重复集会?
After installing .Net 4 and getting some questions that were already answered here I also realized how the Framework dlls are repeated in several places for the different Framework versions (this is not new, it happens with previous versions, but hadn't paid attention to it until now)
1 - GAC: %systemroot%\assembly
2- Framework installation directory: %systemroot%\Microsoft.NET\Framework\v...
3- and if you have the Windows SDK installed, also in: C:\Program Files\Microsoft SDKs\Windows\
I think the last ones are the so called "Reference Assemblies" and have extra metadata to aid Visual Studio, but
what about location number 2? Why are assemblies repeated there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,这是 .NET 1.x 到 3.5 的 GAC 位置。 4.0 的 GAC 位于 c:\windows\microsoft.net\ assembly 中。为什么要移动它还不清楚,可能是为了避免直接从 GAC 引用程序集的项目出现麻烦,这是一个很大的禁忌,但它已经完成了。
是的,参考程序集就在那里。也在 c:\program files\reference assembly 中。它们最初是存储在 GAC 中的程序集的逐字副本。直到您部署某种修补程序。将它们分开可以确保您构建的程序以“正确的”框架程序集为目标,而不是您碰巧存储在 GAC 中的程序集。
是的,没有框架程序集,只有构建工具。
No, that's the GAC location for .NET 1.x through 3.5. The GAC for 4.0 is located in c:\windows\microsoft.net\assembly. Why it was moved isn't clear, probably to avoid trouble with projects that referenced assemblies directly from the GAC, a big no-no but it has been done.
Yes, reference assemblies live there. Also in c:\program files\reference assemblies. They are initially verbatim copies of the assemblies stored in the GAC. Until you deploy some kind of hotfix. Keeping them separate ensures that you build programs that target the "proper" framework assemblies, not what you happen to have stored in your GAC.
Yes, no framework assemblies are there, just build tools.
这更多的是有根据的猜测,而不是实际的答案,但是......
为了最初 GAC 一个 DLL,您需要有一个完整的 DLL(也称为非引用程序集)供 GAC 使用。参考程序集将无法工作,因为它没有可执行代码。因此,您需要一个真正的 DLL 来获取 GAC,这样您就可以得到位置 #2。
This is more of an educated guess than an actual answer but ...
In order to initially GAC a DLL you need to have a full DLL (aka not-reference assembly) for the GAC to use. The reference assembly won't work as it doesn't have executable code. Hence you need a real DLL in which to source the GAC so you get location #2.