I would like to list all of the classes that are in a DLL without having to load the dependencies. I don't want to execute any functionality, I just want to find out (problematically) what classes are inside of a given DLL. Is that possible? I've tried using the assembly.GetTypes() call, but it fails because of dependencies for executing the DLL. Is there any other way to list all the public classes?
相关问题
- C# how to invoke a field initializer using reflect
- How do I create a multidimensional array of object
- Get all classes of a package
- Java-Reflection - find the Arguments and the annot
- Java - How to get annotations from Proxy class?
相关文章
- Are GetCallingAssembly() and GetExecutingAssembly(
- Why doesn't reflections.getSubTypesOf(Object.c
- Load a .NET assembly from the application's re
- Get list of classes in namespace in C# [duplicate]
- How to get struct field names in Rust? [duplicate]
- Issue creating ImmutableMap with Class<?> as
- Can the “dynamic” type vary safely in a generic co
- TYPE_USE annotations get lost when type is nested,
You can use Assembly.ReflectionOnlyLoad method to load assembly without executing it.
How to: Load Assemblies into the Reflection-Only Context
Also you need to attach AppDomain.ReflectionOnlyAssemblyResolve as In the reflection-only context, dependencies are not resolved automatically.
I suggest you use the mono Cecil library. This is the basic example:
This will not load all the dependencies.
Okay, I found it. This combination works to get a list of all classes without having to deal with the dependencies:
Assembly assembly = Assembly.LoadFrom(filename); Type[] types = assembly.GetTypes();