Assemble .NET dll in Node.js using edge

假如想象 提交于 2021-02-10 05:11:25

问题


I am not very familiar with dll or .NET. I am trying to run dll libraries using node. I am using edge.js. Essentially, I have a directory bin/Debug with several dll files. I'm looping through the files and trying to assemble each of them o that i can run some methods from the dll.

const edge = require('edge-js')
const dllPath = './somePath/bin/Debug/'
const fs = require('fs')
const path = require('path')
let obj = {}

fs.readdir(dllPath, [], (err, files) => {

  files.forEach((file) => {
    if(file.match(/^(.*\.dll$).*$/)) {

      obj[file.match(/(.*)\.[^.]+$/)[1]] = edge.func({
        assemblyFile: path.join(__dirname, dllPath, file)
      })
    } 
  })
})

However, edge keeps throwing the following error:

Could not load type 'CommandLine.Startup' from assembly 'CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32'

I understand, that if i don't specify a type name in edge.func({assemblyFile: 'someFile', typeName: ''}) edge will construct a type name by assuming the class called Startup. However, I don't know what a type name is or how to find it. Additionally, how could I find the methods inside each of these files?

Any help is appreciated. Thanks!

来源:https://stackoverflow.com/questions/46204177/assemble-net-dll-in-node-js-using-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!