27 March 2014

Resolve Visual Studio Project Mismatch Between Processor Architecture

The Problem

Starting in Visual Studio 2012, you may have seen this .NET Framework compiler warning (it is not an error):
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference [project path], "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
This is easy to resolve! The warning means one of two things:

  1. The target CPU platform (x86, x64, Itanium, etc.) of one or more projects does not match the others
  2. A referenced resource (DLL) is compiled for a different CPU platform than the referring project
Fixing the problem is easy:
  1. Ensure all projects in the solution are set to the same CPU platform target
  2. Ensure projects referencing DLL files are set to the same CPU platform as the DLL

Troubleshooting