Getting Started with SharePoint Development and Visual Studio 2010
Written By: Ray Barley -- 2/24/2011 --
(13) comments --
Categories: SharePoint 2010, SharePoint Foundation 2010, Visual Studio
< Prev -
- Next >
| Become a paid author
I'm just getting started developing some customizations for SharePoint 2010
and I'd like some help getting ramped up on how to do this using Visual Studio
2010. My initial task is to develop some web parts.
Visual Studio 2010 has built-in support for developing all sorts of
SharePoint 2010 customizations. The development environment is pretty much
on par with what we've become accustomed to when we use Visual Studio to develop web applications, windows
forms applications, and so on. At a high level Visual Studio 2010 provides
the following capabilities for developing SharePoint customizations:
- SharePoint Connections node in the Server Explorer, allowing you to
examine the properties of SharePoint objects
- Project types for a variety of SharePoint customizations such as web
parts, content types, workflows, and so on
- Creation of SharePoint features; a feature encapsulates functionality and
can be activated and deactivated by an administrator
- Creation of the SharePoint solution package; the solution package is the primary
deployment mechanism for SharePoint. It contains the features and
other assets to be deployed to SharePoint.
- Deployment to a SharePoint site on your development machine for debugging and testing
- Integrated debugging
In this tip I will discuss each of the above capabilities and use the
creation of a simple web part as an example to introduce SharePoint 2010
development with Visual Studio 2010.
Let's first lay down the basics that you need in
place to start developing SharePoint customizations with Visual Studio 2010.
In no particular order here are the considerations for your development
- You need one of the following editions of Visual Studio 2010:
Professional, Premium or Ultimate. The Express versions do not have
the built-in SharePoint development capabilities. The details on the
specific features in each edition can be found
- Install everything you need for development on a single machine; this
can and probably should be a virtual machine using Hyper-V, VMWare, Windows
7 or Windows 2008 Server boot from VHD, etc.
- You must use a 64 bit operating system
- Choose Windows Server 2008 (or later) as your operating system.
You can also use Windows Vista or Windows 7 but these
will require a bit more work to get SharePoint and its prerequisites installed
Take a look at
the Development Environment for SharePoint 2010 on Windows Vista, Windows 7,
and Windows Server 2008 for the details; be sure to read the article
thoroughly and perform every step, especially for Windows Vista or Windows
- Run Visual Studio as an administrator. Right click on it in the
Microsoft Visual Studio 2010 program group and select Run as Administrator
from the popup menu.
Sharepoint Server Explorer
The Server Explorer includes a SharePoint Connections node as shown below.
This allows you to drill down into a SharePoint site collection and browse the
The information is read-only so it just provides the opportunity to
examine the properties of an object. For example expand the List Templates
node, expand the Tracking node, right click on Tasks, and select Properties from
the popup menu. The properties for the Tasks list template are shown
When you create a new SharePoint project in Visual Studio 2010,
you will see the following project types available in the SharePoint 2010
As you can see most of the typical SharePoint customizations are available.
Each one typically creates the appropriate artifacts that are necessary; you can
just start writing code, debugging and testing. There are some SharePoint
customizations that Visual Studio 2010 does not directly support such as a
Custom Action; for these you have to create and / or edit the necessary files on
Create a New Project
In the previous section I showed the new project dialog. In this
section I will go through creating a project. To begin select the Empty SharePoint Project and fill in the dialog as shown
The Empty SharePoint Project is a good starting point; you can add specific
SharePoint items to the project. Click OK to continue and the SharePoint
Customization Wizard is displayed as shown below:
The information requested is the site collection to use for debugging and
whether to deploy a sandboxed or farm solution. It is a good idea to
create a site collection to use just for debugging and testing, rather than
using the default site collection that gets created for you when you install and
configure SharePoint. The reason is
that if you get things fouled up you can delete the site collection, create a
new one, and continue. The farm solution runs with full trust whereas the
sandboxed solution runs with limited trust. The sandboxed solution is a
great feature to use; however, there are various limitations such as
restrictions on the SharePoint API, no access to the file system, and so on.
For our example we can use a sandboxed solution. Click Finish to complete
the creation of the new project.
The Solution Explorer and Project Properties are shown below (if necessary
click View on the menu then select Solution Explorer):
The above shows us the starting point for the Empty SharePoint Project.
The main points are:
< Prev -
- Next >
- MSSharePointTipsWebParts is the name of our project
- The project properties are shown in the Properties window
- The Features node is the container for the features that will be created
as we add SharePoint items to the project
- The Package node is the container for the information required to package the features and other assets into a
SharePoint solution file for deployment