C# 项目中dll类库引用了多个版本,造成了冲突的解决办法
备注:常见问题
未能加载文件或程序集“System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个
原因分析:程序所依赖的dll 和实际引用的dll不相符,可以用修改配置文件web.config的方式实现兼容
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <runtime>    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">      <dependentAssembly>        <assemblyIdentity name="System.Web.Http.WebHost"publicKeyToken="31BF3856AD364E35"culture="neutral"/>        <bindingRedirect oldVersion="0.0.0.0-5.2.2.0"newVersion="5.2.2.0"/>      </dependentAssembly>      <dependentAssembly>        <assemblyIdentity name="Newtonsoft.Json"publicKeyToken="30ad4fe6b2a6aeed"culture="neutral"/>        <bindingRedirect oldVersion="0.0.0.0-7.0.0.0"newVersion="7.0.0.0"/>      </dependentAssembly>      <dependentAssembly>        <assemblyIdentity name="System.Net.Http.Formatting"publicKeyToken="31bf3856ad364e35"culture="neutral"/>        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0"newVersion="5.2.3.0"/>      </dependentAssembly>      <dependentAssembly>        <assemblyIdentity name="System.Web.Http"publicKeyToken="31bf3856ad364e35"culture="neutral"/>        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0"newVersion="5.2.3.0"/>      </dependentAssembly>      <dependentAssembly>        <assemblyIdentity name="System.Data"publicKeyToken="b77a5c561934e089"culture="neutral"/>        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0"newVersion="4.0.0.0"/>      </dependentAssembly>      <dependentAssembly>        <assemblyIdentity name="System.Net.Http"publicKeyToken="b03f5f7f11d50a3a"culture="neutral"/>        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0"newVersion="4.0.0.0"/>      </dependentAssembly>    </assemblyBinding>  </runtime> | 
本文来自博客园,作者:jevan,转载请注明原文链接:https://www.cnblogs.com/DoNetCShap/p/17789401.html

 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号