Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.


I was writing a console application using Visual Studio 2012 to use SPWebApplication object of SharePoint 2013.

SPWebApplication webApp = SPWebApplication.Lookup(new Uri(http://c4968397007:3695/));

When I ran the application I was getting the following error

Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.

How to resolve? In the solution explorer right click on the project and then click on Properties. Click on Build tab. Check whether Platform Target is selected as Any CPU. Make sure Prefer-32 bit is not selected.

After doing these changes I ran the application, it worked fine.