无法访问方法Newtonsoft.JSON .Net Core 2. * [英] Cannot access methods Newtonsoft.JSON .Net Core 2.*
问题描述
我有一个使用.Net Core 2.1(VS 2017)的多个项目的解决方案. 我可以在我的Web项目中使用Newtonsoft.JSON.JsonConvert,而对对象进行序列化和反序列化没有任何问题.
I'm have a solution with multiple projects all using .Net Core 2.1 (VS 2017). I can use Newtonsoft.JSON.JsonConvert in my web project without any problem for serializing and deserializing objects.
同一解决方案中的另一个项目与我的Web项目具有相同的Nuget包(版本和SDK). Intellisense可以识别JsonConverter,但显示的唯一方法是Equals,因此没有SerializeObject或DeserializeObject.
Another project in the same solution has the same Nuget packages (version and SDK) as my web project. Intellisense recognizes JsonConverter, but the only method that shows is Equals, so no SerializeObject or DeserializeObject.
当我在控制台应用程序中打开JsonConvert定义时,它具有名称空间 Newtonsoft.Json 和公共抽象类JsonConverter
When I open the JsonConvert Definition within my console application it has the namespace Newtonsoft.Json and a public abstract class JsonConverter
当我在Web项目中执行相同操作时,将获得名称空间 Newtonsoft.Json 和公共静态类JsonConvert
When I do the same within the web project I get the namespace Newtonsoft.Json and a public static class JsonConvert
最后一个包含我要使用的方法,但是我不知道为什么会出现此问题以及如何解决它.
The last one contains the methods I want to use, but I've no idea why this problem is occurring and how to solve it.
推荐答案
好像我需要JsonConvert而不是JsonConverter ...
Looks like I needed JsonConvert instead of JsonConverter...
这篇关于无法访问方法Newtonsoft.JSON .Net Core 2. *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!