C#异常--System.IO.FileLoadException:“混合模式程序集是针对“v2.0.50727”版的运行时生成的错误

异常信息:

System.IO.FileLoadException:“混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。”

解决方案:

在app.config新增如下配置节:

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

详细的startup的配置说明:https://docs.microsoft.com/zh-cn/dotnet/framework/configure-apps/file-schema/startup/startup-element

原文地址:https://www.cnblogs.com/derekhan/p/9987691.html