找不到方法:“虚空Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(布尔)' [英] Method not found: 'Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)'

查看:1707
本文介绍了找不到方法:“虚空Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(布尔)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用由xamarin应用程序共享的便携式类库一个ASP.net MVC应用程序。当我的web应用程序从现在开始,它抛出这个错误:

I have a ASP.net MVC application that is using portable class libraries that are shared by a xamarin application. When my web application starts now, it throws this error:

 Method not found: 'Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)'.

我使用的是结构图MVC的NuGet包,并将其工作正常,直到我引用的PCL库。

I am using the Structure Map MVC nuget package and it was working fine until I referenced the PCL library.

它在这条线code的错误:

It errors on this line of code:

GlobalConfiguration.Configuration.DependencyResolver = new StructureMapDependencyResolver(container);

我觉得它有什么做的PCL类和JSON.net均具有引用了MVC。关于如何解决这个任何想法?我结束了重建我的机器,以确保只有这个版本是在GAC没有别的地方。

I think it has something to do with the PCL class and the MVC both having references to JSON.net. Any ideas on how to fix this? I ended up rebuilding my machine to make sure only this version was in the GAC and no where else.

任何想法

推荐答案

运行由斯科特·艾伦的伟大Pluralsight当然关于MVC4基本面练习文件,当我有同样的问题。与$ P $租赁前的开关更新Newtonsoft.Json没有为我工作。你必须重新安装的WebAPI包。使用下面的命令在包管理器控制台:

I had the same issue when running the exercise files from Scott Allen's great Pluralsight course about MVC4 fundamentals. Updating Newtonsoft.Json with the prerelease switch didn't work for me. You have to reinstall the WebApi packages. Use the following commands in the package manager console:

uninstall-package Microsoft.AspNet.WebApi
uninstall-package Microsoft.AspNet.WebApi.webhost
uninstall-package Microsoft.AspNet.WebApi.core
uninstall-package Microsoft.AspNet.WebApi.Client
uninstall-package Newtonsoft.Json

install-package Microsoft.AspNet.WebApi

我想第一,卸载Microsoft.AspNet.WebApi还要照顾卸载虚拟主机提供商,核心和客户端的 - 但这并没有工作。重新安装Microsoft.AspNet.WebApi则提供了正确版本Newtonsoft.Json作为一个依赖程序集,虽然。

I thought first, that uninstalling Microsoft.AspNet.WebApi would also take care of uninstalling webhost, core and client - but this didn't work. Reinstalling Microsoft.AspNet.WebApi then provides for the correct version of Newtonsoft.Json as a dependent assembly, though.

这之后,它完美地工作。

After that it worked perfectly.

希望这有助于。

这篇关于找不到方法:“虚空Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(布尔)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆