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.
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:
- Right-click on your Project in the Solution Explorer pane in Visual Studio and select Propertise
- Go to the Build tab and select x64 OR Any CPU
- Save changes, rebuild and run your program again.