在搞在線聊天室的時候用到了SignalR 1.1.4,依賴於Newtonsoft.Json 4.5.0.0。
而我另外的dll又依賴Newtonsoft.Json 6.0.0.0
我只引用6.0.0.0的時候提示找不到4.5.0.0的dll,
搜了一下用bindingredirect ,但是搞半天還是報同樣的錯誤,后面發現是配置寫錯了。
錯誤的配置:
<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" PublicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly>
正確的配置:
<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly>
萬能的vs編譯器木有告訴我,我哪里寫錯了。
搜這里知道的:http://stackoverflow.com/questions/3490327/assembly-binding-redirect-does-not-work