简体   繁体   中英

Namespace 'SharePoint' does not exist in the namespace 'Microsoft'

So I am starting to learn C#, like literally just started learning, and coming from a Java background, it doesn't look too bad. However, I have a question. I am following THIS tutorial on using the client-object model. And just starting from the top, I added the references, but using Microsoft.SharePoint.Client; keeps giving me the error that "the namespace 'SharePoint' does not exist in the namespace 'Microsoft', but I clearly see it on the right side panel. So looking at the instructions, the only difference I can think of is that fact that I am using Visual Studio Express and thus do not have the option to choose which framework to use when creating a new project. Other than that, I don't know what the problem might be. Does anyone have any ideas on what else I could be missing or how to correct this problem?

确保目标框架是3.5而不是4,即SP2010

你添加到引用Microsoft.SharePoint.Client组装和Microsoft.SharePoint.Client.Runtime组件, 指出近该教程的开始?

  1. Add required references to the solution.
  2. Make sure that the target framework is 4 for SP2013 (3.5 for SP2010).

Did you do this part of the tutorial you mentioned above?

To build the application, you must add references to two assemblies, Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll. Installing SharePoint Foundation installs these assemblies on the server. The two assemblies are located in the following directory:

%ProgramFiles%\\Common Files\\Microsoft Shared\\web server extensions\\14\\ISAPI

Take a look at the references in your project and make sure you have the reference to the assembly. If it is not there try adding it, right click -->add reference and find "Microsoft.SharePoint.Client"

Thanks to those who mentioned the 4.0 framework.

Mine defaulted to .NET Framework 4 Client Profile (and I have no idea what that means), and the Namespaces looked good in Intellisense, but the build would say they weren't found! Crazy.

for anyone developing for SP2019, you need to target .net 4.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM