配置文件加这个:
<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>
<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>