title: BadImageFormatException with .NET ILMerged DLL in Windows 7 64
body: <p>I'm developing in Windows 7 64-bit with Visual Studio 2008.  I have a collection of class libraries that I merge into a single DLL using ILMerge.  When I try to use this merged DLL, however, I get</p>
  
  <blockquote>
    <p>[<a href="http://msdn.microsoft.com/en-us/library/system.badimageformatexception.aspx" rel="nofollow noreferrer">BadImageFormatException</a>: Could not load file or assembly 'MyMergedDll' or one of its dependencies. An attempt was made to load a program with an incorrect format.]</p>
  </blockquote>
  
  <p>I've been searching around for help with this and it looked like I needed to set the Build property in each project in MyMergedDll to target x86, so I did that.  I also set all non-MSTest projects in the web service in which I'm referencing MyMergedDll to target x86.  I'm still getting this error, however.</p>
  
  <p>If <a href="http://tikotal.blogspot.com/2007/03/attempt-was-made-to-load-program-with.html" rel="nofollow noreferrer">this blog entry</a> is to be believed, I can get this error as a result of doing:</p>
  
  <pre><code>public class SpecificClass: BaseClass: where T : class { }
  </code></pre>
  
  <p>That is, having a class constraint on a generic.  The blog entry is from 2007, though, so I don't know if that still applies.  I wanted some input from StackOverflow as to what you guys think the problem is before I go tracking down every generic class in my projects to check constraints.</p>
  
  <p>If it matters, MyMergedDll is strong-name signed.  I'm trying to use MyMergedDll in both a console application and in a web service.  I don't know if things are perhaps complicated by whether or not IIS is updating every time I rebuild the web service.  With the console application, I only seem to get the <code>BadImageFormatException</code> when I build in Release mode.</p>