SharePoint 2010 Console Application Error – Web Application Could Not Be Found

If you are creating a console application for use with Microsoft SharePoint 2010 you need to ensure that your target platform is Any CPU or x64 for your project.  If the target is x86 you will receive an error The web application at {url} could not be found when creating a new SPSite object.

To change the target platform: select project from Visual Studio menu, choose {project name} properties.   From the properties window select the build tab and set the platform target to Any CPU or x64.

Leave a Reply