A Consol Application or Windows Application in VS 2010 for Sharepoint 2010 : A common Error

Posted by Gino Abraham on Geeks with Blogs See other posts from Geeks with Blogs or by Gino Abraham
Published on Thu, 22 Mar 2012 07:41:50 GMT Indexed on 2012/03/22 11:30 UTC
Read the original article Hit count: 322

Filed under:

I have seen many Sharepoint Newbies cracking their head to create a Console/Windows  application in VS2010 and make it talk to Sharepoint 2010 Server. I had the same problem when i started with Sharepoint in the begining.

It is important for you to acknowledge that SharePoint 2010 is based on .NET Framework version 3.5 and not version 4.0.

In VS 2010 when you create a Console/Windows application, Make Sure you select .Net Framework 3.5 in the New Project Dialog Window.If you have missed while creating new Project Go to the Application tab of project properties and verify that .NET Framework Version 3.5 is select as the Target Framework.

Now that you have selected the correct framework, will it work? Nope if the application is configured as x86 one it will not work. Sharepoint is a 64 Bit application and when you create a windows application to talk to Sharepoint it should also be a 64 Bit one. Go to Configuration Manager, Select x64. If x64 is not available select <New…> and in the New Solution Platform dialog box select x64 as the new platform copying settings from x86 and checking the Create new project platforms check box.

This is not applicable if you are making a console application to talk to sharepoint with Client Object Model.

© Geeks with Blogs or respective owner