Console application new SPSite throws a FileNotFoundException

2010, Dec 24

A collegue of mine had the following problem: he wanted to write a console application to test some SharePoint code, but whenever he opened a new SPSite, the following File Not Found Exception was thrown:

img 52a4a089bfb2b

after being triggered about a possible problem with  the wrong Target Framework, as Visual Studio defaults to .Net 4.0 as target framework, I remembered some wise words that were spoken during the Dutch SharePoint Connections 2010:

"When you are building a console app to work with SharePoint 2010, never forget to change your Platform target from x86 to x64! And I can tell you: You will forget it"

Changing this platform target to x64 was (of course)  the solution to the problem:

img 52a4a097c3bce

My suggestion to him: buy a lot in the lottery, as he can forsee the future ;)