Dealing with 32-bit, 64-bit and Any CPU Compilation Options in .NET

  1. Refer to https://www.codeproject.com/Articles/1160645/Dealing-with-bit-bit-and-Any-CPU-Compilation-Optio
  2. Refer to https://stackoverflow.com/questions/516730/what-does-the-visual-studio-any-cpu-target-mean
    • I think most of the important stuff has been said, but I just thought I’d add one thing: If you compile as Any CPU and run on an x64 platform, then you won’t be able to load 32-bit DLL files, because your application wasn’t started in WoW64, but those DLL files need to run there.

      If you compile as x86, then the x64 system will run your application in WoW64, and you’ll be able to load 32-bit DLL files.

      So I think you should choose “Any CPU” if your dependencies can run in either environment, but choose x86 if you have 32-bit dependencies. This article from Microsoft explains this a bit: