0
votes

I am using visual studio 2010 and trying to build a small console program to add data to users in Sharepoint 2010 using UserProfileManager.

**using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.SharePoint;

using Microsoft.Office.Server.UserProfiles;

using System.DirectoryServices.AccountManagement;

using System.IO;**

The problem I am getting is trying to build this. If my target framework is 4.0 it builds fine, but hence does not run on the server where sharepoint is deployed:

*Unhandled Exception: System.PlatformNotSupportedException: Microsoft SharePoint is not supported with version 4.0.30319.269 of the Microsoft .Net Runtime. at Microsoft.SharePoint.Administration.SPConfigurationDatabase.get_Farm() at Microsoft.SharePoint.Administration.SPFarm.FindLocal(SPFarm& farm, Boolean & isJoined) at Microsoft.SharePoint.SPSite..ctor(String requestUrl) at AddRandomMindtags.Program.Main(String[] args)*

When the target framework is set to 3.5 it gets the following build error:

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

The type or namespace UserProfileManager could not be found...*

Anyone any idea what the problem might be?

Many thanks :)

1

1 Answers

0
votes

As you might be aware that SP 2010 is built on top of 3.NET Framework 3.5, you cannot use 4.0 DLLs while deploying it SP 2010 Server.

And more over what you are trying to do with the UserProfiles?

can you add the reference of this DLL so that your above error will be resolved. C:\Program Files (x86)\Microsoft Chart Controls\Assemblies\System.Web.DataVisualization.dll

Thanks, -Santosh