Here’s your first development tip as you start cranking out SharePoint 2013 solutions using Visual Studio 2012. An old an really annoying problem in Visual Studio 2010 when building SharePoint apps is that it defaulted to creating x86 applications. The problem from a SharePoint perspective is that it gave you this incredibly useless “file not found” error message. Awesome, eh?? :-)
In Visual Studio 2012 the experience is somewhat better, but still needs a little shove to get all the way there. By default now it creates winform projects that use .NET 4.5 (which is good) and which use Any CPU (which is good). Unfortunately it also has a checkbox that says “Prefer 32-bit” which is checked by default (which is not good). The saving grace here is that we have at least dramatically improved the error message now – it tells you that you are running a 32-bit process and you need a 64-bit process to load your SharePoint assembly. The net of this little post is just to go and find that checkbox on the application property pages and uncheck it before you start running your code.