.net 4 环境调用 .net 2 编译的DLL

配置文件加这个:

<startup useLegacyV2RuntimeActivationPolicy="true">
  
<supportedRuntime version="v4.0" />
  
</startup>
  
<runtime>
  
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  
<dependentAssembly>
  
<assemblyIdentity name="XXX" publicKeyToken="YYYYYYYYY" culture="neutral"/>
  
<codeBase version="v2.0.50727" href="XXX.dll"/>
  
</dependentAssembly>
  
</assemblyBinding>
  
</runtime>

原文地址:https://www.cnblogs.com/1971ruru/p/2086032.html