It was a first try of coding for me after upgrading SharePoint 2010. The error hit me.

The code is very simple, just making an object of a site as follows.

SPSite site = new SPSite(“http://mydev”);

This simple line made the ‘System.IO.FileNotFoundException’ error.

Cause of the error is just a setting of a Visual Studio project. It was set to x86 on 64 bit machine. After changing it, the error has gone.