Tuesday, June 28, 2011

Error: The type or namespace name 'SPSite' could not be found (are you missing a using directive or an assembly reference?)

Error:
The type or namespace name 'SPSite' could not be found (are you missing a using directive or an assembly reference?)

Reason:
Sometimes you will get this issue, while you are testing/developing your SharePoint code through console applications.

By default, visual studio 2010 will set target framework as ".Net Framework 4 Client Profile"

Solution:
We need to change the target framework as ".Net Framework 3.5"

To do this,

1. Go to Solution property in visual studio.

2. Change the target framework to ".Net Framework 3.5" as below:

3. Save all & build the solution.

Thats it...




1 comment:

  1. Really good solutions. I have a question to ask,

    I have some images in my sql server database, I need to bring it in a sharepoint list or library or whatever it is. Even I tried with external lists but it is not showing anything that is associated with the image column itself. Kindly post a new solution.
    *The database is external.

    ReplyDelete