0

I have 64 bit dll Test.dll. Load this dll through reflation from 32 bit exe.

AssemblyName name = AssemblyName.GetAssemblyName("Test.dll"); 
assembly = Assembly.Load(name);

But the Load method give below exception :

An unhandled exception of type 'System.BadImageFormatException' occurred in TestDll.exe like "Could not load file or assembly 'Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."

Can any one suggest how to fix this?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
mahen
  • 165
  • 3
  • 16

1 Answers1

-1

To use the method Load you must use the QualifiedName of the assembly. If you only use an string, the instantiation could be ambiguous and it won't work. Please see how you can use this method in the official doc.

https://msdn.microsoft.com/en-us/library/system.reflection.assembly.load(v=vs.110).aspx

And here is an stackoverflow thread where people speak about this.

How to get C#.Net Assembly by name?

Community
  • 1
  • 1
acostela
  • 2,597
  • 3
  • 33
  • 50
  • I don't think this is correct. 1. The problem isn't that it can't find the assembly. 2. They're not passing a string to `Load`. – Ash Burlaczenko Dec 10 '15 at 07:37
  • Correct ,My dll created in 64 bit environment .I wants load this dll in my 32 bit exe through Load method. – mahen Dec 10 '15 at 09:03