I am writing a supplemental program for the software that came with a programmable robot. The DLL structure has about 6 DLLs that I can reference, with another set that I need to load at runtime.

The ones I need to load at runtime have a class inside them that I need to create an instance of just to read some properties. The class is name 'cGame' but when I try:

Assembly asm = Assembly.LoadFile(path);
Type t = asm.GetType("cGame");

t is null. I think the problem is that 'cGame' is derived from a class called 'cGame' in a different namespace. When I try:

Assembly asm = Assembly.LoadFile(path);
Type[] t = asm.GetTypes();

it throws an exception about not being able to load the file or assembly. The assembly it throws the error on is one that I have referenced in the project.

Does anyone have any ideas that might be helpful?

Recommended Answers

All 3 Replies

AssemblyName urassemblyname= AssemblyName.GetAssemblyName("path or dll name");

Type t = asm.GetType("cGame");

You need the full name here

Type t = asm.GetType("namespace.cGame");

any ideas for getting the namespace? the namespace changes with each dll and I need to iterate thru the dlls I can't reference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.