Visual Studio 2010 & SharePoint Server Code


You have downloaded Visual Studio 2010 RC and SharePoint 2010 Beta and now you’d like to use VS to develop on top of SharePoint. You can use one of the following approaches:

Approach Extension Usage VS Project Type
Solution Wsp Add functionality on top of SharePoint. Anything under the SharePoint template node (Web Part, List Definition, Content Type, etc…)
Client Application Exe, dll, xap End User Windows\Silverlight apps, Assemblies Anything that uses SharePoint Client OM, Web Services, RPCs
Server Application Exe, dll Admin tools Anything that uses SharePoint Server OM (Ex: referencing Microsoft.SharePoint.dll)

The point behind this blog post is to ensure that you have the right Visual Studio 2010 settings for compiling and running SharePoint Server applications or assemblies.

Compile Issue

Warning 1 The referenced assembly “Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL” could not be resolved because it has a dependency on “System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which is not in the currently targeted framework “.NETFramework,Version=v4.0,Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.

Resolution

SharePoint 2010 is built on top of .Net Framework 3.5. So make sure you have it as your targeted framework in VS. Go to project properties and change the target framework to “.Net Framework 3.5”.
Run Issue
The Web application at <url> could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
Resolution
You have an x64 version of SharePoint Server installed, but VS 2010 is building your code as x86. So go to project properties \ Build and change platform target from x86 to x64.

One thought on “Visual Studio 2010 & SharePoint Server Code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s