How to get all types in a referenced assembly?

后端 未结 3 939
盖世英雄少女心
盖世英雄少女心 2020-12-09 14:51

For whatever reason, I can\'t seem to get the list of types in a referenced assembly. Not only that, I can\'t even seem to be able to get to this referenced assembly.

3条回答
  •  Happy的楠姐
    2020-12-09 15:18

    I also landed in a situation where I had to get all the assemblies that are in the list of references in Visual Studio.

    I used following work around to get it done.

    var path = AppContext.BaseDirectory;  // returns bin/debug path
    var directory = new DirectoryInfo(path);
    
    if (directory.Exists)
    {
        var dllFiles = directory.GetFiles("*.dll");  // get only assembly files from debug path
    }
    

提交回复
热议问题