I have a custom outputter for my USQL job which basically writes json output in a file using JsonTextWriter. I get following error when I try to compile
error: "The type 'Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'." at line: 60, column 20
Line number 60 is
writer.WriteValue("Test");
I basically get this error for all the lines where I am doing WriteValue
Here is my SampleOutputter
using Microsoft.Analytics.Interfaces;
using Microsoft.Analytics.Types.Sql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Newtonsoft.Json;
namespace JSONOutputter
{
[SqlUserDefinedOutputter(AtomicFileProcessing = true)]
public class JSONOutputter : IOutputter
{
// Local variables initialization
private bool isHeaderRow;
private Encoding encoding;
private JsonTextWriter writer;
// Parameters definition
public JSONOutputter(bool isHeader = true, Encoding encoding = null)
{
this.isHeaderRow = isHeader;
this.encoding = ((encoding == null) ? Encoding.UTF8 : encoding);
}
// The Close method is used to write the footer to the file. It's executed only once, after all rows
public override void Close()
{
if (this.writer != null)
{
//Audience Targeting Array End
writer.WriteEnd();
// Survey Object Ends
this.writer.WriteEndObject();
this.writer.Close();
}
}
public override void Output(IRow row, IUnstructuredWriter output)
{
if (this.writer == null)
{
// Json.Net (writer)
this.writer = new JsonTextWriter(new StreamWriter(output.BaseStream));
writer.WriteStartObject();
}
// Metadata schema initialization to enumerate column names
ISchema columns = row.Schema;
// Header row output--runs only once
if (isHeaderRow)
{
string val = row.Get<string>(0);
if (val != null)
{
writer.WritePropertyName("key",escape:true);
writer.WriteValue("Test");
}
}
Please help