FileNotFoundExceptoin when writing SharePoint 2010 code in Visual Studio

This is more of a note to self, how could I forget again, I’m an idiot post than anything else. So here it goes, if you’re writing a app that is supposed to do anything with SharePoint and get FileNotFoundException when trying to new up a SPSite object.

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

SPSite-FileNotFound

Chanses are you’re Platform Target is set to ”x86”. Change that to “Any CPU” or “x64” and you should be good to go.

PlatformTarget

This is only a SharePoint 2010 issue, not 2007.