The Code Jedi

Using Platform Specific Libraries from a Platform Agnostic Project

Scenario: You are writing an application or library which targets the "AnyCPU" platform, but reference an external library (such as LeadTools) which are platform specific (x86/32 bit, x64/64 bit)

This situation is handled in several places, as there is no one unifying solution which applies to all phases of development.

During the Development Process

Storing the references

Create one folder for each supported platform. These can be placed either in a central location, or a subfolder of the solution/project. Best practice is to name the folder after the target platform. While this is by no means required, it is strongly recommended and urged.

  • x86
  • AMD64
  • IA64 (very rate, not covered in this article, but the same steps apply and will work)

Initial project creation and adding references

Add the references to the project through Visual Studio as you typically would. Choose the binaries which are applicable for the platform which are presently using.