MVCnet4.0引用 Newtonsoft.Json.dll版本,升级冲突问题

来源:互联网 发布:ubuntu安装tar.gz文件 编辑:程序博客网 时间:2024/06/10 20:31

         因MVC使用版本为net4.0,升级问题太多问题,放弃升级版本5.0。在要引用Newtonsoft.Json 9.0.0.0版本时运行报错,说是没有找到“Newtonsoft.Json 4.0.0.0”版本,需要我引用4.0.0.0版本,但是我需要引入高级版本来执行我的class。

         net4.0版本默认使用Newtonsoft.Json.dll 4.0.0.0,需要引用高级版本需要做一下步骤:

1、先在引用那里把旧版的Newtonsoft.Json 4.0.0.0删除,在引入高级的9.0.0.0版本;

2、在web.config<runtime>新增一个

<runtime>

<assemblyBindingxmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentityname="Newtonsoft.Json"publicKeyToken="30AD4FE6B2A6AEED"culture="neutral"/>

<bindingRedirectoldVersion="0.0.0.0-6.0.0.0"newVersion="9.0.0.0"/>

</dependentAssembly>

</assemblyBinding>

</runtime>

3、重新编译一次,再运行。


原创粉丝点击