A deep technical view into the new development tools for
SharePoint 2010 in Visual Studio 11 Beta.
As most of you already know, Microsoft has released a new
version of its IDE, with a public beta program. This version has a
new graphic style (following the famous "metro style") and a lot of
new capabilities for developers. You can read about them directly
from the public beta
Like version 2010, also Visual Studio 11 Beta (we don't know yet
what will be the real name) does have its internal tools for
SharePoint development, but the new version comes with new
features, some bug fixed and useful improvements.
First of all, let's keep in mind that all these new stuff are
related to Visual Studio only. A new version of SharePoint has not
been announced yet, so all the information you can learn from this
article will help you in developing solutions just for SharePoint
2010 and SharePoint Online. Also, you have to remember you cannot
use the new features of the .NET Framework 4.0 or 4.5, because
SharePoint is still running on the 3.5 version.
With all this in mind, we can start looking at the new IDE and
what's new for SharePoint developers.
Streamlined SharePoint project templates
Changes are visible as soon as we are in the "new project"
window, and not only because of the new colors and icons: in order
to simplify our work in creating new SharePoint solutions, the "new
project" window presents a smaller number of project templates than
the previous one.
Here below, in detail, the project templates available:
> "SharePoint 2010 Project"
- the classic empty project with the basic structure of a
SharePoint solution that in Visual Studio 2010 corresponds to the
"Empty SharePoint Project" template.
> "SharePoint 2010 Silverlight Web Part" -
the only new template, useful to create a new solution with the
provisioning of an instance of the SharePoint 2010 "Silverlight Web
Part" and a new related Silverlight project.
> "SharePoint 2010 Visual Web
Part" - the template that creates a SharePoint solution
with a single Visual Web Part. Compared to the previous version of
the development tools, we can now choose this template either with
a Sandboxed solution or with a Farm solution.
> "Import SharePoint 2010 Solution
Package" - the template that enables us to import and
modify a SharePoint solution in .WSP format. Regarding this
feature, there are no changes compared to the previous version of
> "Import Reusable SharePoint 2010
Workflow" - the template that enables us to import a
custom workflow in .WSP format, so we can change it and re-deploy.
Also in this feature, there are no changes compared to the previous
version of the IDE.
This configuration makes our SharePoint development certainly
faster: now we have only 5 templates compared to the previous 14 of
Visual Studio 2010!
Improved support for Sandboxed solutions
Another very useful improvement of Visual Studio 11 Beta is the
support for Sandboxed solutions. If we try to insert a new item
into our SharePoint solution, the IDE helps us in choosing the
right templates based on the type of our solution.
The image above shows how Visual Studio 11 highlights all the
item templates that we cannot insert in our Sandboxed solution
using the label "Farm solution only". So we are able to choose only
item templates without that label for our Sandboxed solution.
Speaking about improvements, another important one is related to
the intellisense. In fact, intellisense automatically hides all
those members of the SharePoint 2010 server object model that
cannot be used inside a Sandboxed Solution. For example, in figure
below you can see that the property "EventReceivers" (for the
type "SPEventReceiverDefinitionCollection") hides the "Add"
method, which is explicitly excluded from the documentation.
Finally, the new version of the development tools for SharePoint
2010 in Visual Studio 11 displays a compiler error if you attempt
to use farm-only API calls. So you can't go in the wrong way and
fall on runtime errors.
All these useful stuffs were already available using an external
add-in from Microsoft, called
Visual Studio 2010 for SharePoint Power Tools. The only
difference is that now, using Visual Studio 11, they are integrated
into the IDE and this is part of the great work and the big
interest that Microsoft puts in the Sandbox world.
Sandboxed visual web part
As it has been already said before in this article, Visual
Studio 11 Beta includes a new template that enables us to create a
simple Visual Web Part within a Sandboxed solution. This is another
great improvement for Sandboxed solution development, because now
we can create new web parts using a visual designer as well in a
In the past, we had to install the CKS Development Tools or the
SharePoint Power Tools in order to be able to use this feature.
With Visual Studio 11 Beta we have it integrated directly into the
From the developer's perspective, there is no difference in
using a visual web part into a Sandbox solution instead of using it
into a Farm solution; you always have:
• an .ASCX file, that enables you to write HTML markup or
visual designer or the code designer,
• a .WEBPART file, in order to specify web part properties and
place the web part into the web part gallery and, finally,
• an .XML file (called "Elements.xml" as usual) in which you can
specify web part instance properties.
The only things changed are code-behind files (C# or
In Visual Studio 2010 we have two files, one for the user
control code-behind and one for the real web part. Now, using
Visual Studio 11, we have one .CS (or .VB) file that inherits
directly from the "System.Web.UI.WebControl.WebParts.WebPart" class
and one "designer" file that ends with the extension ".ascx.g.cs".
You can see in the figure below the basic structure of a Sandboxed
Visual Web Part.
That file is a dynamic code behind file, generated automatically
by the IDE, which creates methods for each ASP.NET or SharePoint
controls that it finds into the user control markup file.
You can see an extract of that file in the next figure.
During .WSP package creation, Visual Studio 11 does not include
the .ASCX file; it's no longer needed because, as you can see, all
the markup and controls have been placed directly into the compiled
Bye bye "package" menu action
Another thing I'd like to talk about, is a minor change into the
action menu related to any single SharePoint solution.
In the past, in order to package our solution and create the
.WSP file into our file system we used the "package" menu action
from the contextual menu that appears right-clicking over our
SharePoint projects from the Solution Explorer. Now that action was
replaced with a new one: the "Publish" action.
That new action, allows us to both publish a solution to a
remote SharePoint site collection (see details about this feature
in the next paragraph), and generate the .WSP file and copy it into
a custom location of our file system.
Remote solutions publish and upgrade
Visual Studio 11 Beta provides us another important change and a
useful feature: the possibility of an automatic deployment on a
remote SharePoint site collection, different from your local
environment. In few words, "publishing" a solution now means
"uploading" a Sandboxed solution file to the solution gallery of a
remote SharePoint site collection. Nothing more.
You can be disappointed in understanding that this means we can
publish to a remote site only a Sandboxed solution, not a Farm
At this moment, there are no "rumors" about the opportunity to
publish a Farm solution and I don't know if it will be implemented
or not in the next version of the IDE or in a future version of
SharePoint. But for those of us that work a lot with Sandbox
solutions, it is definitely a great thing, since it allows
deploying the .WSP directly into the solution gallery of any
SharePoint site collection, where you have site collection
This means that you can at last make the automatic deployment of
custom solutions including SharePoint Online, after a valid
Now… cool down! You still have to install the server product in
your local environment to develop custom SharePoint applications
for SharePoint 2010 or SharePoint Online. This is by design, and I
think it will never change.
Remember that you can install SharePoint 2010 in a Windows 7
In order to make your first remote publishing, you can create a
new Sandboxed solution and you can specify the URL of your
SharePoint Online site collection, using the HTTPS protocol.
When you've finished implementing you sandboxed customizations,
you can right-click on your project name from the Solution Explorer
and select the "Publish" action.
Visual Studio 11 will prompt you a window where you can specify
your Office365 username and password in order to access to your
SharePoint Online site collection; after that you'll find your
Sandboxed solution into the solution gallery ready to use. The only
thing that you have to do manually is activation of your
Of course, the new IDE does enable us to upgrade the solution
You can upgrade your solution simply changing its name from the
package window and re-publishing it to the solution gallery.
The only thing you have to do manually in this case is to select
your upgraded solution and click on the "upgrade" button available
on the Ribbon bar.
You can find all details in this page of the SDK:
If you usually implement a lot of Sandboxed solutions in your
daily work, this is a great feature for you guys!
Improved support for creating site columns, content
types and list
Provisioning structures like site columns, content types, list
definition and so on was a little bit difficult for SharePoint
developers using the 2010 version of the IDE. Why? It's very
simple: we had no design support, and we had to remember a lot of
XML syntax in order to create all those stuff.
First of all, Visual Studio 11 Beta has a specific template to
create site columns. Site columns are one of the most basic
elements you can add to a SharePoint project and an item template
to create them is very helpful for developers.
Nothing special, it only creates an .XML with the same syntax
used to create a single site column. This file could be used for
the provision of one or more site columns of course and there is no
designer for this.
Instead, in order to quickly create custom content types and
list definitions, we can now use a specific designer integrated
into Visual Studio 11. If you try to insert a new content type item
into your SharePoint solution, instead of the usual .XML file
you'll see a table that enables you to insert site columns taken
from your site collection or from your project itself using a
simple drop down list. That list has a mechanism of auto-completion
that makes it very easy to use.
As you could see, this is very useful because from this moment
onwards it's not possible to get errors from your content type
provisioning, because there's no way to write wrong syntax in your
In addition, you can also specify different configurations for
the content type using the same designer.
As you can see in the figure below, you can specify the name and
description of your content type, its group, if you want it to
inherit columns from its parent or not, if you want to set it
read-only and if you want to hide it from the new button list or
not, without writing any line of XML code.
However, the .XML file is always present in your solution and
you can open it in order to view the results of the changes done by
the designer or if you want to change something by yourself.
Here after you can find the code generated by the designer:
As I said before, nothing changes from the SharePoint
The same improvement has been also included for List
provisioning. In the past, we specified always a list definition
(even created from a content type) and the related list instance
using a lot of XML code. As for content type's development, the XML
code remains but now it is generated by Visual Studio 11 Beta
designer for SharePoint lists.
If you try to insert a new list into your SharePoint solution,
the IDE asks you from what kind of template or list instance you
want to start in order to make your custom list. After that, Visual
Studio 11 opens a new designer in which you can specify all the
columns and content types that you want to include into your list,
all the views and all generic information like title, description
and the URL of the related instance.
The power of this tool is that it enables us to create new views
for our list definitions, columns and more in general new list
definitions in a very easy way, specifying columns to view with a
simple drop down list, row limits and the default view
configuration. Using Visual Studio 2010 we had to do all these
stuff writing a lot of XML code.
Fantastic, isn't it?
In this article we have described all those new features and
enhancements that we can use in Visual Studio 11 Beta during our
SharePoint solutions development. We have seen that nothing has
changed from the SharePoint perspective: the new features are only
part of an upgrade of the development tools for SharePoint. In
fact, every new feature of the IDE always produces code, files and
configurations that work only with SharePoint 2010 or with
SharePoint Online and we know very well all the stuff.
The main differenceis that Visual Studio 11 helps us in the
generation of those customizations and it makes very fast our
developer process of SharePoint solutions.
Giuseppe Marchi is a enthusiastic
developer, Microsoft SharePoint MVP and co-founder of Dev4Side S.r.l., Giuseppe has
been participating as speaker in the most important SharePoint and
Microsoft technologies related conferences in Italy. He takes care
with passion also of his personal website (www.peppedotnet.it) by
keeping it up to date with technical contents about SharePoint and
.NET Framework as well, always trying to leave time for his family,
friends and football.
Stay tuned for more SharePoint content by joining our community or by
following us on twitter or facebook.