在4.0 .NET Runtime上加载2.0 .NET程序集 [英] Loading 2.0 .NET assembly on 4.0 .NET Runtime
问题描述
全部,
假设我有一个在.NET 2.0下编译的程序集。我可以在没有任何重定向等的.NET 4.0上运行这个程序集吗?
Lets say I have an assembly compiled under .NET 2.0. Can I run this assembly on a PC that has on .NET 4.0 without any redirection etc? Just out of the box.
感谢,
MK
Thanks, MK
推荐答案
因为4.0框架与1.1和2.0 / 3.5并行安装,您将需要安装.NET Framework 2.0,以便在无需修改的情况下运行2.0应用程序。
Because the 4.0 framework installs side-by-side with 1.1 and 2.0/3.5, you would need the .Net Framework 2.0 installed in order to run a 2.0 application without modification.
如果您希望应用程序使用.Net 4.0 Framework运行,您应该更改应用程序配置以执行此操作:
If you would like the application to run using the .Net 4.0 Framework, you should alter the application configuration to do so:
<configuration>
<!-- may need useLegacyV2RuntimeActivationPolicy="true" -->
<startup>
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
如果从.Net Framework 4.0应用程序引用.Net Framework 2.0程序集,您可能必须更新应用程序的清单,但通常在Visual Studio中为您处理。
If you reference .Net Framework 2.0 assemblies from a .Net Framework 4.0 application you may have to update your application's manifest, but usually this is handled in Visual Studio for you.
这篇关于在4.0 .NET Runtime上加载2.0 .NET程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!