Loading an assembly targeted for .NET 4.5 on a .NET 4.0 app domain

别来无恙 提交于 2019-11-28 10:55:35

Assuming a system as .NET 4.0 and .NET 4.5:

As stated in marcgravell's blog linked by sehe

4.5 is an in-place over-the-top install on top of 4.0, in the GAC; once you have installed 4.5, 4.0 runs with the 4.5 assemblies

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.

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. But this shouldn't affect you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!