[英]Loading an assembly targeted for .NET 4.5 on a .NET 4.0 app domain
Assuming the system has .NET 4.0 and .NET 4.5 installed.假设系统安装了 .NET 4.0 和 .NET 4.5。
Is it possible to load and work with a .NET 4.5 assembly from an assembly written targeting .NET 4.0?是否可以从针对 .NET 4.0 编写的程序集加载和使用 .NET 4.5 程序集?
Simply put, can I call Assembly.Load
from .NET 4.0 code to load a .NET 4.5 targeting assembly?简单地说,我可以从 .NET 4.0 代码调用
Assembly.Load
来加载 .NET 4.5 目标程序集吗?
Assuming a system as .NET 4.0 and .NET 4.5:假设系统为 .NET 4.0 和 .NET 4.5:
As stated in marcgravell's blog linked by sehe正如sehe链接的 marcgravell 博客中所述
4.5 is an in-place over-the-top install on top of 4.0, in the GAC;
4.5 是 GAC 中 4.0 之上的就地安装; once you have installed 4.5, 4.0 runs with the 4.5 assemblies
安装 4.5 后,4.0 将与 4.5 程序集一起运行
Then calling Assembly.Load from a .NET code targeting 4.0 (compiled by a 4.0 compiler), will actually run in using the 4.5 framework implementation, so I don't see any reason why it couldn't load a 4.5 assembly.然后从面向 4.0 的 .NET 代码(由 4.0 编译器编译)调用 Assembly.Load,实际上将使用 4.5 框架实现运行,所以我看不出它无法加载 4.5 程序集的任何原因。
margravell notes that problems occur when you try to run .NET 4.5 compiled code on a system with only 4.0 installed, as the implementation of the yield return/break iterators causes a missing method reference. margravell 指出,当您尝试在仅安装 4.0 的系统上运行 .NET 4.5 编译代码时会出现问题,因为 yield return/break 迭代器的实现会导致缺少方法引用。 But this shouldn't affect you.
但这不应该影响你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.