我在哪里放置 edge.js 的 dll 以访问

Where do I put the dlls for edge.js to access

我一直在使用 edge.js 从我的 Node.js 应用程序中调用 C# 函数,但是当我去执行 C# 代码时,我得到例如:

Metadata file 'System.Collections.Generic.dll' could not be found

Metadata file 'System.Text.dll' could not be found

...

我的代码如下,主要是想 运行 使用我从 C# 调用的存储过程的 SSIS 包。基本上找不到我所有引用的 dll?我应该把 edge 的 dll 放在哪里才能找到它们?

var executeSQL = edge.func(function() {
  /*
  #r "System.Data.dll"
  #r "System.Collections.Generic.dll"
  #r "System.Linq.dll"
  #r "System.Text.dll"

  using System.Linq;
  using System.Text;
  using System.Data;
  using System.Collections.Generic;
  using System.Threading.Tasks;
  
  public class StartUp
  {

    public async Task<object> Invoke(object input)
    {
        string result = string.Empty;
        string packagePath = @"\SSISDB\test\package.dtsx";
        string spName = "storedProcName";

       

        using (var conn = new System.Data.SqlClient.SqlConnection("connectionString"))
        using (var command = new System.Data.SqlClient.SqlCommand(spName, conn)
        {
            CommandType = System.Data.CommandType.StoredProcedure
        })
        {
            conn.Open();
            command.Parameters.AddWithValue("@PackagePath", packagePath);
            command.ExecuteNonQuery();
            Console.WriteLine("Finished");
        };

        return null;
    }
  }
  */
});

我知道我可以在没有 C# 的情况下做到这一点,只需在节点内使用像 mssql 这样的模块来执行存储过程,但这只是一个示例测试,用于习惯使用 edge.js

stuartd 的评论在将 dll 与脚本(我试过)放在同一目录下的意义上是正确的,但我仍然遇到同样的问题。我通过将 C# 代码作为一个单独的文件解决了我的问题,然后如下引用该文件作为 executeSSIS 函数的一部分。 payload 只是从我的 node.js 脚本传递到我的 C# 脚本的对象。这样做解决了我的问题。

var payload = {
        filePath: 'C:/temp/xlsx/' + req.file.filename,
        path: req.packageName,
        server: req.server 
    };

var executeSSIS = edge.func({
        source: __dirname + '/cs/Program.cs',
        references: [
        __dirname + '/cs/System.Data.dll'
        ]
    });

executeSSIS(payload);