简体   繁体   English

在4.0 .NET Runtime上加载2.0 .NET程序集

[英]Loading 2.0 .NET assembly on 4.0 .NET Runtime

All, 所有,

Lets say I have an assembly compiled under .NET 2.0. 可以说我有一个在.NET 2.0下编译的程序集。 Can I run this assembly on a PC that has on .NET 4.0 without any redirection etc? 我可以在没有任何重定向等功能的.NET 4.0的PC上运行该程序集吗? Just out of the box. 开箱即用。

Thanks, MK 谢谢,MK

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. 因为4.0框架与1.1和2.0 / 3.5并排安装,所以您需要安装.Net Framework 2.0才能运行2.0应用程序而无需进行修改。

If you would like the application to run using the .Net 4.0 Framework, you should alter the application configuration to do so : 如果您希望应用程序使用.Net 4.0 Framework来运行,则应更改应用程序配置以这样做

<configuration>
   <!-- may need useLegacyV2RuntimeActivationPolicy="true" -->
   <startup>
      <supportedRuntime version="v4.0"/>
   </startup>
</configuration>

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. 如果您从.Net Framework 4.0应用程序引用.Net Framework 2.0程序集,则可能必须更新应用程序的清单,但是通常这是在Visual Studio中为您处理的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM