c# - 无法编译Newtonsoft.Json.Net20

标签 c# visual-studio-2013 compiler-errors json.net

我从http://www.newtonsoft.com/json下载了Newtonsoft.Json代码,并在VS 2013中打开了Newtonsoft.Json.Net20.sln。构建它时,我遇到了很多错误,所有错误都在JsonPrimitiveContract.cs中,这是一个示例

Invalid expression term '[' C:\Users\<path removed>\Newtonsoft.Json-master\Src\Newtonsoft.Json\Serialization\JsonPrimitiveContract.cs   60  13  Newtonsoft.Json.Net20

我也尝试编译Newtonsoft.Json.sln,同样的错误。显然我缺少了什么,只是不知道什么?

最佳答案

Json.NET具有solution .Net 2.0版的targets,但是源代码必须使用C#6.0编译器进行编译。从Issue #802:

06needhamt commented 6 days ago

I am requesting a branch of JSON.NET that can be compiled without c#6 as my organization does not support C# 6 and need to use a source distribution due to modifications,

JamesNK commented 6 days ago

Nope. C# 6 or bust.

Or use the source before C# 6 features.



根据您的问题,您正在使用VS2013。因此,您需要转到VS 2015或尝试将C#6.0安装到VS2013。尽管我从未尝试过,但How to enable C# 6.0 feature in Visual Studio 2013?表示有可能,并解释了如何做。

关于c# - 无法编译Newtonsoft.Json.Net20,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35143431/

相关文章:

c# - 在 C# 中使用可访问性修饰符继承属性

c# - 在 .NET 中,GC.MaxGeneration 不是 2 吗?

c++ - 在 Visual Studio 2013 上使用 QT

python - “NoneType”对象在python小程序中没有属性 'get'

c++ - 如果没有使用某种类型实例化模板,是否可能触发编译器/链接器错误?

c# - Grpc - 将消息从一个客户端发送到连接到同一服务器的另一个客户端

c# - 重新初始化 MembershipProvider ASP.NET

visual-studio-2013 - 找不到 AjaxControlToolkit 的 AjaxMin.dll 路径的一部分

c++ - std::shared_ptr 的 compare_exchange_weak 在 msvs 2013 中损坏了吗?

delphi - IDE编译成功,但dcc32写入: Error: E2010 Incompatible types: 'Integer' and 'NativeInt'