By Vladimir, a .NET developer on Muranosoft’s team.
The new Microsoft Visual Studio 2010 raises the development of SharePoint projects to an absolutely new level. You won’t need to install any special extensions like those in Visual Studio 2008. Visual Studio 2010 supports all the necessary tools, which really help to improve the development process.
So let’s take a look at the new SharePoint development features that Visual Studio 2010 offers.
New Project Templates
First of all, the VS 2010 supports many different templates for the SharePoint projects, such as:
• Blank Site Definition
• Content Type
• List Definition
• State Machine Workflow
• WSP Import
• Business Data Catalog Model
• Deployment Module
• Event Receiver
• Sequential Workflow
• Web Part
After selecting any of these templates, you have to go through some steps to configure your development environment, of course.
SharePoint Solution Architecture
Any project type will include two key nodes that you can’t remove, relocate or rename. There are Features and Package nodes. These ones will be available in a project, even if your project doesn’t contain any feature or package definition.
The “Features” node contains all your project features. If you want to add a new feature, just right click on this node and select “Add Feature.” You can use the new Feature Designer tool to manage a corresponding feature.
The “Package” node contains only one *.WSP file, which describes the deployment rules of your SharePoint project. Double clicking on this file affects the Package Designer tool, which allows you to configure all deployment aspects.
In addition to these nodes, the VS 2010 contains the package explorer, which also allows you to manage your SharePoint items. For example, you can group files into features or packages, raise the Features/Packages designer, or move files from one feature or package to another.
Changes in the Server Explorer
Now the Server Explorer supports a new node called SharePoint Connections. This node contains the URL to all your SharePoint sites. You can add the new site by clicking on the SharePoint Connections node, clicking “Add Connection” and entering the URL to the SharePoint site. This will allow you to browse the contents (such as features, lists and sites) and configure the SharePoint server settings.
Development
Some few features are directly linked with a development process. These include the new Client Object Model, LINQ to SharePoint, Sandboxed Solutions and “External Data Lists.”
- Client Object Model allows us to have direct access to the object model by using JavaScript, Silverlight or .NET code without calling Web Services.
- LINQ to SharePoint provides an ability to use usual LINQ-queries to manipulate with SharePoint lists. Now we can forget about foreach’es and other redundant code in many cases.
- Sandboxed Solutions allow us to deploy our Web Parts without having an administrative privilege. It was one of the biggest problems in previous versions of the SharePoint environment. This is achieved by running solutions in a separate process that is restricted by .Net CAS policy. So the framework can control solutions and shut down any of them automatically.
- External Lists (formerly known as the Business Data Catalog) is a powerful mechanism to organize collaboration your SharePoint project with other applications or data sources. You should describe an entities structure and link with a data source. After that, you can use received data in your SharePoint project.
Debug and Deploy Process
As you may know, the debug and deploy processes were quite difficult in the previous versions of Visual Studio. The newest one dramatically changes this work, offering us an absolutely new way. Now you shouldn’t deploy your package on the server, deactivate and uninstall all features, retract the solution manually, etc. You shouldn’t install an additional Visual Studio on your SharePoint server, either, just to debug your code.
After configuring your SharePoint solution, you just press the F5 button and the installation of your package will be done automatically, even if an old solution has been installed on the server. All work (deactivating, retracting, etc.) will be done automatically. Amazing, isn’t it?
After installing the new package, the Visual Studio’s debugger will be attached to the Windows SharePoint services process. To enable this, you should run you project in the debug mode (when you first debug, VS suggests to modify your web.config file accordingly). Please note, you could use it on your development side, not on the SharePoint server side!
Resources
If you want to get more information, you can watch this video or follow this link to read the official documentation. There is another great article about new tools for SharePoint development in the VS 2010, written by Steve Fox, senior technical evangelist. Also, I suggest you take a look at the short training courses provided by Channel 9.
Enjoy!