Console application new SPSite throws a FileNotFoundException

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:

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:

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

Published Fri, Dec 24 2010 10:09 AM by Bas

Comments

# re: Console application new SPSite throws a FileNotFoundException

Monday, January 10, 2011 4:48 PM by vnykr

Very helpful information.

"which is commonly made mistake"

Thanks alot

~vnykr

# re: Console application new SPSite throws a FileNotFoundException

Thursday, October 13, 2011 11:19 AM by Ofcourse

Learned the same thing at a SP 2010 Developer course. Thanks for reminding me ;)

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 3 and 6 and type the answer here: