I tried Assembly.ReflectionOnlyLoadFrom(@"path\System.Core.dll")
and ReflectionOnlyLoad but i got exceptions and errors. How do i properly get all the namespaces/classes in an assembly?
For example i got this exception.
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Here is your answer to your question. I do not need to copy & paste it here for you, it might be greener to save space rather that copying code from the other thread. :-)
If you can reference System.Core then
If you cannot, you will need to attach to the AssemblyResolve event of the CurrentDomain and load all assemblies of types that System.Core.dll uses when loading the dll.
To load an assembly and then get a list of all types:
Unfortunately this will throw an exception if any of the types exposed cannot be loaded, and sometimes this load failure cannot be avoided. In this case however the thrown exception contains a list of all types that were successfully loaded and so we can just do this:
This will give you a list of all types, including interfaces, structs, enums etc... (If you want just the classes then you can filter that list).