====== nodejs에서 c# dll 연동하기 (edgejs) ====== ===== .net dll 테스트코드 ===== - 파일명 : Sample105.cs using System.Threading.Tasks; namespace Sample105 { public class Startup { public async Task Invoke(object input) { return this.Add7((int)input); } int Add7(int v) { return Helper.Add7(v); } } static class Helper { public static int Add7(int v) { return v + 7; } } } ===== C# source Code Compile ===== - command 명령어로 library compile 을 한다. E:\dev>"C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\csc.exe" /target:library /debug Sample105.cs ===== node 설치 ===== - node install 명령으로 node_module 를 설치한다. E:\dev> npm install edge-js ===== node sourceCode ===== - 파일명 : edgeCall.js var edge = require('edge-js'); var add5 = edge.func('Sample105.dll'); add5(22, function (error, result) { if(error) throw error; console.log(result); }); ===== edge-js 로 C# dll 호출하기 ===== - node 명령을 실행한다. E:dev> node edgeCAll.js 29 ===== 참고링크 ===== - http://tjanczuk.github.io/edge/ - http://nextir.blogspot.com/2014/06/nodejs-net-dll.html