Archive for the ‘SharePoint 2010’ Category

SharePoint (Beginner) : FileNotFoundException

May 10, 2011 2 comments

For a beginner developerĀ in SharePoint 2010 (with no experience with older version of SharePoint), you might be coding some simple “Hello World!” as your first SharePoint application. You might create a new Windows Console Application Project from Visual Studio and copy some sample codes from somewhere and try to run it. So you hit the magical F5 button and your project compiles successfully. However, when the program tries to run, Visual Studio throws you an FileNotFoundException, like the image below.

SharePoint 2010: FileNotFoundException

SharePoint 2010: FileNotFoundException

You then might be searching for codes error, is the SharePoint service running, & etc and found out that everything is running fine. So what’s the error?

The solution to this is to check your project platform target. By default, Visual Studio platform target is 32-bit (x86). Note that SharePoint 2010 ONLY runs on a 64-bit (x64) platform. So, you couldn’t run a 32-bit program on a 64-bit SharePoint Server. Now, to change your project platform to 64-bit, follow the steps below:

  1. Right-click on your Project in the Solution Explorer pane in Visual Studio and select Propertise
  2. Go to the Build tab and select x64 OR Any CPU
  3. Save changes, rebuildĀ and run your program again.

SharePoint 2010: FileNotFoundException - 2