原创

无法加载文件或程序集'Newtonsoft.Json,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'

最近在玩推特的SDK,引用了[CoreTweet][1]的库。 在运行tokens.Statuses.Update方法的时候,报错提示:

无法加载文件或程序集'Newtonsoft.Json,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'

研究后发现,我虽然项目中已经引用了Newtonsoft.Json包,但是版本跟CoreTweet中的不一样。

知道这个就好解决了,因为我是WinForm程序,所以修改app.config即可。 在app.configconfiguration节点中增加:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
           <assemblyIdentity name="Newtonsoft.Json"
               publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
           <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="12.0.0.0"/>
       </dependentAssembly>
    </assemblyBinding>
</runtime>

其中newVersion使用你的Newtonsoft.Json版本号。

参考: [未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0"][2] [1]:https://github.com/CoreTweet/CoreTweet [2]:https://blog.csdn.net/mzl87/article/details/52353787

本文来自:无法加载文件或程序集'Newtonsoft.Json,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'-小码农,转载请保留本条链接,感谢!

温馨提示:
本文最后更新于 2020年07月10日,已超过 1,376 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录