Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral

1.6k Views Asked by At

The context of this issue is .net core 1.1 and electron-edge:

I created a super simple C# library in .Net Core 1.1 with .Net Standard 1.6. I finished dotnet restore, dotnet build and dotnet release etc. .... per the documentation successfully. Things went on well and I moved all DLLs, json files, etc. from the publish folder to a folder called "dll" within the folder where node runs. So, it looks like this: C:\electron-quick-start\dll

var clrMethod = edge.func({
    assemblyFile: 'dll\\MyLibrary.dll',
    typeName: 'MyLibrary.Startup',
    methodName: 'Invoke'
});

clrMethod('This text comes from JavaScript!', function (error, result) {
    if (error) throw error;
    console.log(result);
});

When I run the js file, I receive the error message mentioned in the subject line. Then I set the following environment variables:

EDGE_USE_CORECLR=1
EDGE_APP_ROOT = C:\electron-quick-start\dll

But I received this error message / exception:

TypeError: edge.initializeClrFunc is not a function

Even I tried to put all contents of "dll" folder side by side where node is running and that resulted into no success. Also, I set app root to the exact publish folder generated by dotnet release and that was not conclusive either.

What is missing in this exercise or may have been done wrong?!

As a side note: I am using the recent version of electron-edge.

0

There are 0 best solutions below