A.DLL 引用了6.0 的 newtonsoft.json  (V2 运行时),B.DLL 引用了10.0 的 newtonsoft.json (V4 运行时)。 可以在.CONFIG RUNTIME 中加指向 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
oldVersion="0.0.0.0-12.0.0.0" newVersion="6.0.0.0" ;根目录放  的JSON DLL 版本,一定要和 newVersion="6.0.0.0"  版本一致。

 

配置项目是大小写敏感的。

实测,主程序是.NET FRAMEWORK 4.0 写的;
主程序引用的newtonsoft.json 是6.0 V2 运行时的,B.DLL 引用的JSON 10.0是 V4 运行时,newVersion指向10.0 JSON ,根目录放置的是 10.0  JSON ,程序能正常运行。
反过来,主程序引用10.0JSON  (V4),B.DLL 引用 6.0 JSON (V2),newVersion指向10.0 JSON ,根目录放置的是 10.0  JSON ,程序能正常运行。


多运行时混合要加 useLegacyV2RuntimeActivationPolicy="true" 。

--

 

 

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  
  
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
          <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

</configuration>

 

 

--

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄