Sunday, March 27, 2011

SPSite: FileNotFoundException was unhandled

I create a console project in Visual Studio 2010.

After adding a reference to Miscrosoft.SharePoint, I add following code in the project:



When it opens a SPSite, FileNotFoundException is thrown as below:


Since the console project set the Platfrom target is X86 as default and I run the project under X64 environment. Therefore, I need to update the Platform target to x64.

1. Right click the project
2. Click Properties
3. Click Build and update the value in Platfrom target


No comments:

Post a Comment