我有一个 SignalR 和 Ext.net 的项目。两者都需要 Newtonsoft.Json。
SignalR 需要 Newtonsoft.Json 4.5.0.0,而 Ext.net 需要 4.0.8.0。
我的绑定重定向根本不起作用。在我的 web.config
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="4.0.8.0" newVersion="4.5.0.0"/>
</dependentAssembly>
但是当它绑定时
=== 预绑定状态信息 === 日志:DisplayName = Newtonsoft.Json,版本 = 4.0.8.0,文化 = 中性,PublicKeyToken = 30ad4fe6b2a6aeed (完全指定) 日志:Appbase = file:///C:/Users/*****/Documents/Visual Studio 2012/Projects/QuotaBuilder/branches/1Install/QMSSite/ 日志:初始 PrivatePath = C:\Users\*****\Documents\Visual Studio 2012\Projects\QuotaBuilder\branches\1Install\QMSSite\bin 调用程序集:Ext.Net,版本=1.6.0.1867,文化=中性,PublicKeyToken=2e12ce3d0176cd87。 === LOG:此绑定在默认加载上下文中开始。 日志:使用应用程序配置文件:C:\Users\*****\Documents\Visual Studio 2012\Projects\QuotaBuilder\branches\1Install\QMSSite\web.config 日志:使用主机配置文件:\\pacrl-fsrv02\userdata$\*****\My Documents\IISExpress\config\aspnet.config LOG:使用 C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config 中的机器配置文件。 日志:政策后参考:Newtonsoft.Json,版本=4.0.8.0,文化=中性,PublicKeyToken=30ad4fe6b2a6aeed 日志:正在尝试下载新的 URL 文件:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/862fb004/45708817/Newtonsoft.Json.DLL。 日志:尝试下载新的 URL 文件:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/862fb004/45708817/Newtonsoft.Json/Newtonsoft.Json.DLL。 日志:正在尝试下载新的 URL 文件:///C:/Users/*****/Documents/Visual Studio 2012/Projects/QuotaBuilder/branches/1Install/QMSSite/bin/Newtonsoft.Json.DLL。 警告:比较程序集名称导致不匹配:次要版本 ERR:无法完成程序集的设置(hr = 0x80131040)。探测终止。
据我所知,Post-policy 引用应该是重定向版本,而不是原始请求。然而它被完全忽略了。我之前在这个项目中也遇到过这个问题,但在过去我已经能够获得它所要求的版本,因为没有两个单独的依赖项。