PlatformNotSupportException When Using VS 2012 With SharePoint 2013

While I writing a small console to insert items in SharePoint 2013 task list, I got the follwoing error:

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

An her the screen shot of the exception:

0

Solution

Right click on the project in Solution Explorer and click on Properties

1

Then go to Build tab and do the following:

  • Platform target >> Any CPU
  • Clear the check box on “Prefer 32-bit

2