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
分类:
C#
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)