3

Suppose we have an application that is targeted to Any CPU, but this application uses third-party assemblies that have two flavors, a 32-bit and a 64-bit. Which one on them must be used?

If the "Any" option runs an application in both 32 bit and 64 bit, how can I give it two versions of an assembly?

My specific need is a .NET SQLite driver.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126

2 Answers2

2

Real simple:

  • If you target your app for "Any CPU", all things being equal, the app can run on 32- or 64-bit systems.

  • If your "Any CPU" app has dependencies on 32 or 64 bit dll's, it will fail if it tries to run on a system that's missing the dependency.

  • If you want to "run everywhere", then your best bet might be to target 32-bit (instead of "Any CPU"). You really don't need 64-bit unless you have a special requirement for 64 bit.

  • If you encounter "BadImageExceptions" running your app in 64-bit land, you might wish to consider "Custom Actions":

    http://adamhouldsworth.blogspot.com/2010/10/64bit-custom-actions.html

paulsm4
  • 114,292
  • 17
  • 138
  • 190
0

Because you are most likely to be statically referencing the assemblies, you will need two editions of your application - one compiled as x86 and one compiled as x64.

I'm not knowledgeable specifically about the Sqllite driver, but usually using a x86 version of the driver should be sufficient, this will still run on an x64 system via the mechanism of WOW32 emulation. This means you can compile just the one version (x86) for installation on to both x86 and x64 systems (as mentioned by Mark Hall on your previous question). You only need to compile for x64 if you are going to employ x64 specific features (like larger data types, more available RAM, etc).

Community
  • 1
  • 1
slugster
  • 49,403
  • 14
  • 95
  • 145