Console application in Visual Studio 2010 to access Sharepoint object model

You can experience some “beginners” troubles when you create your “test something in Sharepoint” first console application with new Visual Studio 2010. You will not be able to build project unless you do some changes:

After you added Reference to Microsoft.Sharepoint.dll (which you will find only by browsing to c:program filescommon filesmicrosoft sharedweb server extensions14isapi) you can start programming with Sharepoint API but when you try to run your app, you will get compilation error.

To solve it:

Right click project, select Properties.

On first section (Application) change target framework  – .Net Framework from 4.0 to 3.5.

Under Build section change Target platform to 64 bit.

Now, try to run your app again.

Leave a Reply