title: Calling a method inside a .NET 32-bit dll from a .NET 64-bit exe using reflection
body: <p>I have a 32 bit .NET class library having a simple public class and a simple public method. I have a 64 bit .NET console application where using reflection, I wish to load the 32 bit assembly and consume its method.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Reflection;
  using Host.TestLib;
  
  namespace test
  {
      class Program
      {
          static void Main(string[] args)
          {
              var lib = Assembly.LoadFrom("Simple32bitAssembly.dll");
          }
      }
  }
  </code></pre>
  
  <p>When I run this I get the following exception thrown:</p>
  
  <pre><code>System.BadImageFormatException was unhandled
  Message=Could not load file or assembly 
  'file:///E:\AjitTemp\c\32bit64Bit\ReflectionTest\test\bin\Debug\Simple32bitAssembly.dll' 
  or one of its dependencies. An attempt was made to load a program with an incorrect format.
  </code></pre>
  
  <p>Googling suggests that I need to create a 64 bit wrapper for this 32 bit dll and load this wrapper using relection in my 64 bit console application? Is this the way? Any sample code would be very helpful.</p>