How do I include the System.Runtime.Serialization.Json namespace in a VSCode project on Mac OS X?

I was hoping to use System.Runtime.Serialization.Json

in a simple Visual Studio Code console app on my Mac OS X, but I ran into this compilation error:

The type or namespace name 'Json' does not exist in the namespace 'System.Runtime.Serialization' (are you missing an assembly reference?)

Based on this post Where is the System.Runtime.Serialization.Json namespace? , I added "System.ServiceModel.Web": "1.0.0"

to the project.json file but it is not so Help. I added 1.0.0

since the only version I found on nuget is https://www.nuget.org/packages/System.ServiceModel.Web/

Alternatively, I tried using https://www.nuget.org/packages/Newtonsoft.Json/6.0.8 adding the following to my project.json - "Newtonsoft.Json": "6.0.8"

but then adding the link using Newtonsoft.Json;

again gives a compilation error -The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

Ultimately, I would like to derserialize the json stream from my VSCode console app, so hopefully get pointers on how this can be done?

+3


source to share


1 answer


System.Runtime.Serialization.Json

will not migrate to .Net Core; you did the right thing by choosing Newtonsoft.Json

.

Unfortunately, you only added it to the section dnxcore50

; you need to add it to the framework-agnostic dependencies section:



{
  "version": "1.0.0-*",
  "dependencies": {
    "System.ServiceModel.Web": "1.0.0",
    "Newtonsoft.Json": "6.0.8"
  },
  "commands": {
    "run": "run"
  },
  "frameworks": {
    "dnx451": {},
    "dnxcore50": {
      "dependencies": {
        "System.Console": "4.0.0-beta-*",
        "System.ServiceModel.Web": "1.0.0"
      }
    }
  }
}

      

+2


source







All Articles