winform程序,framework4.0 运行程序 报错

错误如下:

System.IO.FileLoadException was unhandled
Message=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的startup节点添加属性: useLegacyV2RuntimeActivationPolicy="true"

最终像这样

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

 

问题解决.

相关文章:

  • 2021-04-09
  • 2021-06-16
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-11-05
  • 2021-08-17
猜你喜欢
  • 2021-10-25
  • 2021-08-29
  • 2022-01-12
  • 2021-12-24
  • 2021-12-03
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案