UserProfileManager dll 未在目标框架 3.5 中构建

本文关键字:构建 框架 目标 dll UserProfileManager | 更新日期: 2023-09-27 18:35:59

我正在使用Visual Studio 2010,

并尝试构建一个小的控制台程序,以使用UserProfileManager向Sharepoint 2010中的用户添加数据。

**使用系统;

使用 System.Collections.Generic;

使用System.Linq;

使用系统文本;

使用 Microsoft.SharePoint;

使用 Microsoft.Office.Server.UserProfiles;

使用System.DirectoryServices.AccountManagement;

使用 System.IO;**

我遇到的问题是试图构建这个。如果我的目标框架是 4.0,它构建良好,但因此无法在部署 SharePoint 的服务器上运行:

*未处理的异常:System.PlatformNotSupported异常:Microsoft SharePointMicrosoft .Net 运行时版本 4.0.30319.269 不支持。 at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Farm() at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, Boolean&isJoined) 在Microsoft.SharePoint.SPSite..ctor(String requestUrl) at AddRandomMindtags.Program.Main(String[] args)*

当目标框架设置为 3.5 时,它会得到以下生成错误:

*命名空间"Microsoft"中不存在类型或命名空间名称"Office"(是否缺少程序集引用?

找不到类型或命名空间 UserProfileManager ...*

有人知道问题可能是什么吗?

非常感谢:)

UserProfileManager dll 未在目标框架 3.5 中构建

您可能知道 SP 2010 是在 3.NET Framework 3.5 之上构建的,因此在部署 SP 2010 服务器时不能使用 4.0 DLL。

还有更多关于您要尝试使用用户配置文件做什么?

您能否添加此DLL的引用,以便解决上述错误。C:''Program Files (x86)''Microsoft 图表控件''程序集''系统.Web.数据可视化.dll

谢谢-桑托什