標籤:sse 程式 今天 成功 更新 lin redirect entity 類庫
今天遇到了一個比較坑的問題,琢磨了好久。。。
因為需要引用一個第三方的類庫,三方的類庫引用的是Newtonsoft.Json.dll 版本7.0.0而我的項目中引用的是Newtonsoft.Json.dll 版本4.5.0,這樣兩個引用造成了衝突。所有的引用都OK,編譯時間提示“ Newtonsoft.Json.Linq”未引用,可是這明明已經引用了。嘗試使用nuget更新,更新到最新版9.0.0,更新成功後可以一成功編譯,但是訪問時又出現這個樣的問題。
最終解決方案,修改web.config,這裡只是告訴大家格式,只用添加完整的dependentAssembly內容即可。
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </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> </assemblyBinding> </runtime>
解決未能負載檔案或程式集“Newtonsoft.Json ...."或它的某一個依賴項。找到的資訊清單定義與程式集引用不匹配。 (異常來自 HRESULT:0x80131040)