title: .NET, "Any CPU/64Bit (x64)/32Bit (x86)" Best Practices, Tips and Tricks
body: <p>If a .NET program directly or indirectly needs to call platform dependent/native/un<a href="http://en.wikipedia.org/wiki/Managed_code" rel="nofollow noreferrer">managed</a> code it might crash.</p>
  <p>This 32-bit/64-bit theme came into my mind after I got a new laptop with Windows 7 64-bit installed and tried to develop with the <a href="https://en.wikipedia.org/wiki/SQLite" rel="nofollow noreferrer">SQLite</a> database.</p>
  <p><code>System.Data.SQLite</code> contains managed code plus unmanaged code. There is a 32-bit version and a 64-bit. Both have the same filename, but different size, and your EXE file must use the right one.</p>
  <p>To make it more complicated: My <a href="https://stackoverflow.com/questions/3341808/64-bit-version-of-vs2010-runs-in-32-bit-version">Visual Studio 2010 debugger is a 32-bit application</a>, so I cannot debug when using &quot;System.Data.SQLite-64bit&quot; from the <a href="http://en.wikipedia.org/wiki/Global_Assembly_Cache" rel="nofollow noreferrer">GAC</a>!</p>
  <p>As .NET developers we need guidelines/know-how/best practices.</p>
  <p>And the best place to collect this kind of information that I know of is <a href="https://stackoverflow.com/">this site</a>.</p>
  <p>So please, share your ideas and known issues which could serve as best practices or guidelines to survive in the 32/64/anyCPU .NET world.</p>
  <p>I would favor one issue/trick per &quot;answer&quot;
  so it can be commented/updated/referenced easily.</p>
  <ul>
  <li>feel free to give several &quot;answers&quot;.</li>
  </ul>
  <p>I will share my own knowledge as answers to this question, too.</p>