LoginSignup
3

More than 5 years have passed since last update.

Edge.jsで.NETクラスの参照を追加する方法

Posted at

node.jsからC#、C#からnode.jsを使えるライブラリEdge.jsでハマった(個人的に)のでメモ

node.jsからC#を使ってWindowsサービス状態を取得する、というテストをしていたところ、以下のエラー

ref_error.png

Visual Studioで開発を行っている場合、ソリューションの設定から参照を追加すれば済む話だが、Edge.jsでの参照追加の方法がわからず...

解決方法

呼び出し側のjsで、必要な名前空間を参照する
references で指定します

test.js
let test = edge.func({
    source : require('path').join(__dirname, 'service-status.cs'),
    references : ["System.ServiceProcess.dll"]
});

※思いっきりドキュメントに記載がありました
How to: specify additional CLR assembly references in C# code: tjanczuk/edge

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
3