Error: The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

freezegravity
freezegravity used Ask the Experts™
on
Hello:

Here's something I am finding particularly annoying. An web site (application) in Asp.net 2.0 seems to be work just fine one minute, but won't even compile the next minute. I don't even have to change the code for the page that is throwing the compilation error in the title, but, it is worse if I add something perfectly valid to a page (drag a text box or SqlDataSource to the page).

Any idea why that might be ... the line of code is:

using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

What do you think I am doing wrong?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2007
Commented:
Have you added a Reference in the project?

Open the Solution Explorer Right Click and Select Add Reference, then find the Microsoft.SharePoint namespace/dll

Author

Commented:
I am not seeing the "Microsoft.SharePoint" namespace after I right click and select "Add Reference" (at least not in the .NET tab. There are several look alikes though. For instance, "Microsoft Office SharePoint Server component"

Now I suppose the question is how do I find/add that reference and how did I manage to delete it in the first place.

THANKS!

Author

Commented:
actually, I just added all references that remotely resembled SharePoint. And it seems to work now. I'll let you know when the erratic thing changes

For now, enjoy the points!

THANKS!

Commented:
Hi!
I have the same problem! I  also added the reference to the reference list, but still...Did you find the solution?
reference-problem.bmp
reference-problem2.bmp
Download the SharePoint extensions for Visual Studio 2008 (or 2005 - whatever) from downloads.microsoft.com then you can add the appropriate reference(s).

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial