.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Developing for SharePoint 2010 in Visual Studio 2010

Posted By:Manning       Posted Date: February 02, 2011    Points: 75    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article The author discusses opening a new project for SharePoint 2010, selecting the correct .NET framework, and choosing a template for Web Parts development in Visual Studio 2010 project

This article is taken from the book SharePoint 2010 Web Parts in Action. The author discusses opening a new project, selecting the correct .NET framework, and choosing a template for Web Parts development in Visual Studio 2010 project.

40% off any version of SharePoint 2010 Web Parts in Action with the checkout code dnspark40. Offer is only valid through www.manning.com.

Visual Studio 2010 is the primary development environment that you will use to build your Web Parts and other SharePoint 2010 projects. You can use other environments or tools, but the SharePoint Development Tools for Visual Studio will save you a lot of time and allow you to be more productive. The SharePoint Development Tools for Visual Studio are a new addition to the Visual Studio suite, even though there were extensions for Visual Studio 2005 and 2008 that could be downloaded. These new extensions are targeted for SharePoint 2010 development only.

           Visual Studio Extensions for Windows SharePoint Services 3.0
There were extensions for SharePoint 2007, MOSS 2007, and WSS 3, called Visual Studio Extensions for Windows SharePoint Services (VSeWSS) that could be downloaded to Visual Studio 2005 and then 2008. These extensions were criticized and never exited the CTP (Community Technology Preview) stage. For SharePoint 2007 development, the community was faster than Microsoft and created really great tools that were used more and were more flexible than VSeWSS. The two most popular community contributions were STSDev (http://stsdev.codeplex.com) and WSPBuilder (http://wspbuilder.codeplex.com).

The SharePoint Developer Tools in Visual Studio allow you to edit and configure your SharePoint solutions using visual designers instead of working with the XML files directly. It also gives you an F5 deployment and debugging experience just as any other solutions built with Visual Studio. In the following sections we are going to walk through the initial SharePoint 2010 development experience with Visual Studio 2010 and look at the different types of projects that you can create. For

Visual Studio 2010 comes in many flavors, from the free edition called Visual Studio 2010 Express, to the top-notch edition called Visual Studio 2010 Ultimate that contains everything you need from design, development, testing, and life cycle management. All editions except the free Express edition have the SharePoint Development tools.

You need to run Visual Studio 2010 in Administrator mode if you have the User Account Control enabled on your server or workstation. That's because deployment and debugging require full access to the processes and the files in SharePoint root.

Starting a project in Visual Studio

To create a project in Visual Studio, you always start with a project template. The SharePoint Development Tools installs a set of templates for SharePoint projects and we are going to use some of these throughout this book.
The SharePoint Extensions for Visual Studio 2010 comes with a set of Project Templates for SharePoint 2010 development; from an empty project to specialized projects like Web Parts, lists, and workflows. To create a SharePoint project, we need to start a new project in Visual Studio. This is done by select File > New > Project. The New Project dialog will show all the available project templates.

Selecting target framework

The first time you open this dialog you need to select the target framework for your project. The default framework in Visual Studio is version 4.0 but SharePoint 2010 is based on Microsoft .NET 3.5. You should select version 3.5 as your target framework. Visual Studio will change your project so that .NET Framework 3.5 is used even if you select version 4.0. You change the target framework using the dropdown in the New Project dialog.

Selecting a template

After selecting the framework, you need to find the SharePoint templates which you do in the template category selector on the left hand, as seen in figure 1.

Select Visual C# > SharePoint > 2010 to find the available templates for SharePoint 2010 development. Depending on your Visual Studio edition and the extensions you have installed, the templates may vary. Since SharePoint is based on Microsoft .NET, you can use the language of your choice, such as Visual Basic or even F# or C++. If you prefer to use Visual Basic, you select Visual Basic > SharePoint > 2010 to see those templates, which are exactly the same as for C#. C# is currently the most popular .NET programming language, and you will find most samples and demos on Internet and on sites such as Codeplex using C#.

Figure 1 The New Project dialog in Visual Studio 2010 shows the available SharePoint 2010 templates including a brief description of the selected template.

Using the dialog shown in figure 1, you specify the name of your project, the solution, and the file system location. A Visual Studio 2010 solution is a collection of projects in which you can subsequently add more projects. Do not confuse the Visual Studio solution with a SharePoint 2010 solution. Each project based on the SharePoint templates will result in one SharePoint solution package. You cannot create a SharePoint Project on a machine that does not have SharePoint 2010 installed.

The default templates in Visual Studio 2010 for SharePoint 2010 development are listed in table 1. When working with Web Parts you will mainly use the Empty SharePoint Project and the Visual Web Part template.

Table 1 All out-of-the-box SharePoint 2010 templates in Visual Studio 2010

Template Name

Empty SharePoint Project
Creates an empty SharePoint 2010 solution in which you can add items and features
Visual Web Part
A project with a Visual Web Part item
Sequential Workflow
A project for creating a sequential workflow
State Machine Workflow
A project for creating a state machine workflow
Business Data Connectivity Model
A project for creating a model for the Business Connectivity Services
Event Receiver
A project for creating an event receiver
List Definition
A project for creating a list definition
Content Type
A project for creating a content type
A project for creating a module


In this brief article, we discussed how to begin a SharePoint 2010 project using Visual Studio 2010. We discussed starting a new project, selecting a framework, and choosing a template.

SharePoint 2010 Web Parts in Action

Wictor Wilén
MEAP Release: March 2010
Softbound print: December 2010 (est.) | 375 pages
ISBN: 9781935182771

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend