agracio / edge-js

Run .NET and Node.js code in-process on Windows, macOS, and Linux
MIT License
643 stars 95 forks source link

Unable To Compile C# Code #132

Closed PrexCoder closed 3 years ago

PrexCoder commented 3 years ago

Hi, I'm trying to reference an external dll "EPPlus.dll" to be precise, but for some reasons it keeps saying that he can't find this dll, I got this dll using nuget in another project, then from packages/epplus/5.5.4/lib/net5.0 from there I've extracted EPPLus.dll and EPPlus.xml

var dllTest = path.join(__dirname, 'EPPlus.dll'); var CsCode = path.join(__dirname, 'CsCode.cs'); var test = EdgeJs.func({ source: CsCode, references: [ dllTest ] });

CsCode.cs `using System.Threading.Tasks; //ignore

r "EPPlus.dll"

public class Startup { public async Task Invoke(object input) { return "hello world"; } } `

I've tried to see with a console log if I get the correct path for the dll and cs file, and it is correct, but I still get this error

image

PrexCoder commented 3 years ago

Took me sometime to realise that I was doing something stupid, this is how my code looks now with the problem solved.

var dllTest = path.join(__dirname, 'EPPlus.dll'); var CsCode = path.join(__dirname, 'CsCode.cs'); var test = EdgeJs.func({ source: CsCode, references: [ dllTest ] });

CsCode.cs using System.Threading.Tasks; public class Startup { public async Task Invoke(object input) { return "hello world"; } }

I hope this will help somebody, cheers :)