top of page
Writer's pictureVijai Anand Ramalingam

How to resolve "The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft'

How to resolve "The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) "for console application in Visual Studio 2010.

In this article we are going to see how to resolve "The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) "For console application in Visual Studio 2010. Even though if you add the Reference Microsoft.SharePoint.dll in your console application and if you try to build your application, you will be getting the above error.

I have created one Console application using Visual Studio 2010 and I have added the reference Microsoft.SharePoint.dll.














And I have added the namespace Microsoft.SharePoint.

  1. using System;

  2. using System.Collections.Generic;

  3. using System.Linq;

  4. using System.Text;

  5. using Microsoft.SharePoint;

  6. namespace CreateListItem

  7. {

  8. class Program

  9.     {

  10. static void Main(string[] args)

  11.         { }

  12.     }

  13. }

When you hit the F5 you will be getting the following error.



How to resolve this error:

  • Go to the Solution explorer.

  • Right click on the Solution Explorer and click Properties.

  • Select Application Tab, by default Target Framework will be .Net Framework 3.5 Client Profile change it to .Net Framework 3.5.


  • Once you change the Target Framework "Target Framework Change "wizard will pop up.

  • Click Yes.

  • Go the Build tab and change the Platform Target to x64.

  • Hit F5 now you will be able to debug successfully.

Summary:

Whenever you want to create Console Application in Visual Studio 2010 for SharePoint 2010 remember that the target framework should be changed as I have said in this article to build your code successfully.

0 comments

Comments


bottom of page