I'd like to point a C# application at a DLL and get a list of the types defined in that DLL. What I have so far looks right on the surface, but is giving the error indicated below.
using System.Reflection;
...
static void Main(string[] args)
{
Assembly SampleAssembly;
SampleAssembly = Assembly.LoadFrom("C:\\MyAssembly.dll"); //error happens here
foreach (Type tp in SampleAssembly.GetTypes())
{
Console.WriteLine(tp.Name);
}
}
/*
This will give me:
Unable to load one or more of the requested types.
Retrieve the LoaderExceptions property for more information.
I wish it would give me something like this:
MyClass1
MyClass2
MyClass3
*/