简体   繁体   English

命名空间“SharePoint”在命名空间“Microsoft”中不存在

[英]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.所以我开始学习 C#,就像刚开始学习一样,来自 Java 背景,看起来还不错。 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;我正在关注有关使用客户端对象 model 的教程。从顶部开始,我添加了引用,但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?一直给我这样的错误:“命名空间‘Microsoft’中不存在命名空间‘SharePoint’,但我在右侧面板上清楚地看到它。所以查看说明,我能想到的唯一区别是事实我正在使用 Visual Studio Express,因此在创建新项目时无法选择要使用的框架。除此之外,我不知道问题可能是什么。有没有人对我还能做什么有任何想法丢失或如何纠正这个问题?

确保目标框架是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). 确保SP2013目标框架为4(SP2010为3.5)。

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. 要构建应用程序,必须添加对两个程序集的引用,Microsoft.SharePoint.Client.dll和Microsoft.SharePoint.Client.Runtime.dll。 Installing SharePoint Foundation installs these assemblies on the server. 安装SharePoint Foundation会在服务器上安装这些程序集。 The two assemblies are located in the following directory: 这两个程序集位于以下目录中:

%ProgramFiles%\\Common Files\\Microsoft Shared\\web server extensions\\14\\ISAPI %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" 如果不存在尝试添加它,右键单击 - >添加引用并找到“Microsoft.SharePoint.Client”

Thanks to those who mentioned the 4.0 framework. 感谢那些提到4.0框架的人。

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! 我的默认为.NET Framework 4客户端配置文件(我不知道这意味着什么),并且命名空间在Intellisense中看起来很好,但是构建会说它们没有找到! Crazy. 疯。

for anyone developing for SP2019, you need to target .net 4.5对于为 SP2019 开发的任何人,您需要定位 .net 4.5

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft名称空间中不存在ApplicationInsight - ApplicationInsight does not exist in the namespace Microsoft 命名空间“Microsoft”中不存在“EntityFrameworkCore” - 'EntityFrameworkCore' does not exist in the namespace 'Microsoft' EntityFrameworkCore 在命名空间 Microsoft 中不存在 - EntityFrameworkCore does not exist in the namespace Microsoft 命名空间“Microsoft.VisualBasic”中不存在类型或命名空间名称“FileIO” - The type or namespace name 'FileIO' does not exist in the namespace 'Microsoft.VisualBasic' 类型或名称空间名称“ DirectX”在名称空间“ Microsoft” Windows 8.1中不存在 - The type or namespace name 'DirectX' does not exist in the namespace 'Microsoft' Windows 8.1 命名空间“Microsoft”中不存在类型或命名空间名称“设备” - The type or namespace name 'Devices' does not exist in the namespace 'Microsoft' 类型或名称空间CodeAnalysis在名称空间'Microsoft.SqlServer.Dac中不存在 - The type or namespace CodeAnalysis does not exist in the namespace 'Microsoft.SqlServer.Dac 命名空间Visualstudio在命名空间Microsoft中不存在,缺少程序集引用 - namespace Visualstudio does not exist in the namespace Microsoft, missing assembly reference 命名空间“Microsoft”中不存在类型或命名空间名称“Bot”? - The type or namespace name 'Bot' does not exist in the namespace 'Microsoft'? 类型或名称空间名称“ FriendlyUrls”在名称空间“ Microsoft.AspNet”中不存在 - The type or namespace name 'FriendlyUrls' does not exist in the namespace 'Microsoft.AspNet'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM