命名空间“System"中不存在类型或命名空间名称“Json"(您是否缺少程序集引用?) [英] The type or namespace name 'Json' does not exist in the namespace 'System' (are you missing an assembly reference?)
问题描述
我正在使用 .NET Framework 4.5,但遇到了这个问题.命名空间System"中不存在类型或命名空间Json"
I am using .NET Framework 4.5 and I'm having this issue. The type or namespace 'Json' does not exist in the namespace 'System'
所以,我尝试安装包 System.Json -Version 4.0.20126.16343,但后来我遇到了这个问题.
So, I tried to Install-Package System.Json -Version 4.0.20126.16343 but I had this issue afterwards.
类型System.Uri"是在未引用的程序集中定义的.您必须添加对程序集System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"的引用
The type 'System.Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
来源:https://www.nuget.org/packages/System.Json
任何想法将不胜感激!
推荐答案
该软件包已停产,不应再使用.
That package is discontinued and shouldn't be used any more.
如果您有控制台应用程序,我可以推荐两个选项:
If you have a console application, I could recommend two options:
- JSON.NET.不是 .NET Framework 本身的一部分,但比 Microsoft 的实现快得多;
- 微软对
JavaScriptSerializer
.
- JSON.NET. Not a part of the .NET Framework itself, but much faster than Microsofts implementation;
- Microsofts implementation of the
JavaScriptSerializer
.
两者都能够读取和写入 JSON.我发现 JSON.NET 库更易于使用且功能更完整.
Both are capable of reading and writing JSON. I find the JSON.NET library easier to use and more feature complete.
这篇关于命名空间“System"中不存在类型或命名空间名称“Json"(您是否缺少程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!