2

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!

Aldo Sanchez
  • 450
  • 7
  • 23
  • You can browse the DLL with Object Browser in Visual Studio or decompile it with ildasm/DotPeek/.NET Reflector. – Dustin Kingen Sep 13 '17 at 18:09
  • What are the libraries? Are you sure they have any code that would act as an entry point to edge/node? What are you trying to do? – stephen.vakil Sep 13 '17 at 18:15
  • You're only going to be able to access the public methods in the DLLs, and note that you will have to get to them through their namespaces, which may not match their assembly names. @romoku has the best advice; decompile the DLLs and explore then a bit – Jonathan Sep 13 '17 at 18:42
  • I think a type name is just 'string, 'int', etc. So I am guessing edge is asking for the return type of the method you are trying to call? – john k Sep 14 '20 at 15:02

0 Answers0