I have a program that takes a .cs script file as input. I want to read from a JSON file in the script and I'm trying to use the JSON.NET library to do it. However, I'm unable to properly reference the dll file to use the functions inside. I'm NOT using Visual Studio to write the script hence I cannot add the reference using the conventional method.
My code:
//css_reference Newtonsoft.Json.dll;
using Newtonsoft;
using Newtonsoft.Json;
using Newtonsoft.Json.JsonConvert;
public class Script
{
public async void Action(String path)
{
StreamReader re = new StreamReader("job.json");
JsonTextReader reader = new JsonTextReader(re);
JsonSerializer se = new JsonSerializer();
object parsedData = se.Deserialize(reader);
There were three files associated with Newtonsoft library, the .dll file, a .pdb file and a .Json file and all three are placed in the same folder as the script file.
Error:
Namespace Newtonsoft cannot be found in ...
Namespace Newteonsoft.Json cannot be found in ...
If I remove the three using statements, I get namespace not found for StreamReader, JsonTextReaader and JsonSerializer.
I'd like help regarding this issue. Thanks!
usingstatements?install-package newtonsoft.jsonin the package manager console and hit enter