从 C# 调用时 Edge.js 中的 DLL 错误

DLL error in Edge.js when called from C#

首先我安装了最新的 Edge Nuget Package。然后我是 运行 基本的 hello world 起始示例,并且在 Windows 2010 年和 Visual Studio 2015 年 运行 遇到了这个错误。

当我在 OS-X 上执行相同的 hello world 代码时,出现此错误。

这里是局部变量树的突破。看起来错误可能类似。

代码如下所示。它是从字面上复制的 README.md of the repo.

using System;
using System.Threading.Tasks;
using EdgeJs;

class Program
{
    public static async void Start()
    {
        var func = Edge.Func(@"
            return function (data, callback) {
                callback(null, 'Node.js welcomes ' + data);
            }
        ");

        Console.WriteLine(await func(".NET"));
        Console.ReadKey();
    }

    static void Main(string[] args)
    {
        Task.Run((Action)Start).Wait();
    }
}

当您从 nuget 安装 Edgejs 时,它会在您的解决方案中创建一个边缘文件夹。 Node.dll 应该在您的 x64 和 x86 文件夹中。

通过将文件夹 edge 复制到 bin 文件夹中解决了这个问题。

参考:https://github.com/tjanczuk/edge/issues/565#issuecomment-315343743