.Net4的WinForm程序使用.Net2控件

在.Net4的WinForm程序中,混用.Net2控件会报下面的问题

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

解决方法为在App.config文件中,增加以下配置

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Leave a Reply

Your email address will not be published. Required fields are marked *

*