简体   繁体   中英

Loading 2.0 .NET assembly on 4.0 .NET Runtime

All,

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.

Thanks, 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.

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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