Fix for "BadImageFormatException was unhandled" on x64 platforms<p>In case anyone else runs into this, I found a solution on the ADO.NET forum:</p> <p><a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=665884&amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=665884&amp;SiteID=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=665884&amp;SiteID=1</a></p> <p>You need to set Properties &gt; Build &gt; Platform target to &quot;x86&quot;. This will force it to run in WoW64, so the 32-bit mixed model Phoenix assemblies will load.</p> <p>Ravi</p>© 2009 Microsoft Corporation. All rights reserved.Thu, 28 May 2009 16:21:35 Z9a43e9a1-a744-4a1a-bb34-3604254c126bhttp://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/9a43e9a1-a744-4a1a-bb34-3604254c126b#9a43e9a1-a744-4a1a-bb34-3604254c126bhttp://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/9a43e9a1-a744-4a1a-bb34-3604254c126b#9a43e9a1-a744-4a1a-bb34-3604254c126bRavi Pandya - Microsofthttp://social.msdn.microsoft.com/Profile/en-US/?user=Ravi%20Pandya%20-%20MicrosoftFix for "BadImageFormatException was unhandled" on x64 platforms<p>In case anyone else runs into this, I found a solution on the ADO.NET forum:</p> <p><a title="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=665884&amp;SiteID=1" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=665884&amp;SiteID=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=665884&amp;SiteID=1</a></p> <p>You need to set Properties &gt; Build &gt; Platform target to &quot;x86&quot;. This will force it to run in WoW64, so the 32-bit mixed model Phoenix assemblies will load.</p> <p>Ravi</p>Mon, 19 Mar 2007 21:48:23 Z2007-04-16T22:21:42Zhttp://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/9a43e9a1-a744-4a1a-bb34-3604254c126b#f6fdad89-fb59-443d-bcef-efdcfddaca46http://social.msdn.microsoft.com/Forums/en-US/phoenix/thread/9a43e9a1-a744-4a1a-bb34-3604254c126b#f6fdad89-fb59-443d-bcef-efdcfddaca46Kang Su Gatlinhttp://social.msdn.microsoft.com/Profile/en-US/?user=Kang%20Su%20GatlinFix for "BadImageFormatException was unhandled" on x64 platforms<p>Thanks for that link Ravi.  That is correct.  In the future we should change the solutions so that they come out the box as 32bit only.</p> <p>Another thing you can do is set your system so that it uses the 32bit CLR by-default.  You can do this by calling:</p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"><font color="#000000">C:\WINDOWS\Microsoft.NET\Framework<span style="color:red">64</span>\v2.0.50727\<span style="color:red">Ldr64.exe setwow</span></font></span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"><span style="color:red"><font color="#000000">If you're doing this from a Vista box, make sure you run this from an Administrator command prompt.</font></span></span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"><span style="color:red"><font color="#000000">Thanks,</font></span></span></p>Thu, 22 Mar 2007 15:27:00 Z2007-04-16T22:21:42Z