Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
784 views
in Technique[技术] by (71.8m points)

asp.net web api - Json does not exist in the namespace System

In this tutorial: http://www.asp.net/web-api/videos/getting-started/custom-validation Jon uses

dynamic error = new JsonObject();

with

using System.Json;

I guess it's the JsonObject here: http://msdn.microsoft.com/en-us/library/system.json.jsonobject(v=vs.110).aspx located in:

  • Namespace: System.Json
  • Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)

I've added System.Runtime.Serialization a reference but still cannot find System.Json.

Am I reading the Microsoft docs wrong? (I'm using .NET 4.5)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this:

PM> Install-Package System.Json -Version 4.0.20126.16343

Per: http://nuget.org/packages/System.Json

It worked!

If you have questions on how to add enter nuget code, please follow the link below: http://docs.nuget.org/docs/start-here/using-the-package-manager-console


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...