首页 文章

USQL - 自定义输出器无法找到NewtonSoft

提问于
浏览
1

我有一个USQL作业,从Azure Blob读取json,并在一些数据操作后将单行JSON文件写入ADLS . 我写了一个Custom Ouputter来编写JSON文件 .

这就是我的CustomOutputter文件的样子:

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 demo{

    [SqlUserDefinedOutputter(AtomicFileProcessing = true)]
    public class JSONOutputter : IOutputter
    {
     //Actual Code Here
     public static class Factory
    {
        public static JSONOutputter JSONOutputter(bool isHeader = true, Encoding encoding = null)
        {
        return new JSONOutputter(isHeader, encoding);
        }
    }
    }

我在我的USQL Job中使用这个Ouputter,如下所示:

OUTPUT @final_output
    TO "/output/json/final.json"
    USING demo.Factory.JSONOutputter(isHeader: true);

当我使用编译我的USQL脚本时

ADL: Compile Script

我收到此错误:

[Info] Start compiling code behind: /users/kumar.pratik/documents/usql/second.usql.cs ...
    [Error] Command failed: mono /Users/kumar.pratik/.vscode/extensions/usqlextpublisher.usql-vscode-ext-0.2.11/compilehost/compilehost.exe /users/kumar.pratik/documents/usql/second.usql.cs  /Users/kumar.pratik/Documents/usql/usqlCodeBehindReference /Users/kumar.pratik/Documents/usql/second.usql.dll __codeBehind__tRYGlFBeSWcl

    [Error] Compile failed

    error: "The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)" at line: 8, column 6
    error: "The type or namespace name 'JsonTextWriter' could not be found (are you missing a using directive or an assembly reference?)" at line: 17, column 12
    error: "The type or namespace name 'JsonTextWriter' could not be found (are you missing a using directive or an assembly reference?)" at line: 44, column 34

有人可以让我知道如何解决这个问题?

我正在使用Mac OS上的Visual Studio Code

谢谢

1 回答

相关问题