问题
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