因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>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="9.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
3、重新编译一次,再运行。