codelove
codelove

Reputation: 1386

Failing to compile Newtonsoft.Json.Net20

I downloaded Newtonsoft.Json code from http://www.newtonsoft.com/json and opened Newtonsoft.Json.Net20.sln in VS 2013. When I build it I get a bunch of errors, all are in JsonPrimitiveContract.cs, here is one sample

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

I also tried compiling Newtonsoft.Json.sln, same errors. Obviously I am missing something, just don't know what?

Upvotes: 0

Views: 806

Answers (1)

dbc
dbc

Reputation: 116670

Json.NET has a solution that targets .Net version 2.0, but the source code must be compiled using the c# 6.0 compiler. From 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.

According to your question, you are using VS 2013. Thus you need to move to VS 2015 or try to install c# 6.0 into VS 2013. While I've never attempted it, How to enable C# 6.0 feature in Visual Studio 2013? says it might be possible and explains how to do it.

Upvotes: 1

Related Questions