Developing Web Content Management (WCM) solutions on the Microsoft Office SharePoint Server (MOSS) 2007 platform was really challenging. And I’m not talking here about taking care of delivering web standards compliant XHTML, implementing accessibility or making the website lightning fast. I’m talking about the development process itself: from creating the very first custom Site Column to deploying the Solution. There were several tools, none of which fully integrated with Visual Studio or provided a consistent approach. At the end of the day we – SharePoint 2007 developers, became wizards doing the magic of manual tips & tricks and combination of various tools every day just to get the job done. Just recently, when SharePoint 2010 shipped, Microsoft provided us with the new Visual Studio 2010 SharePoint Developer Tools. And although they are called tools, they are more than that. In fact Microsoft provided us with a framework for building developer tools. A new era has come.
Hi, my name is ‘Community Kit for SharePoint: Development Tools Edition’
Before we buckle up and start the engine, let’s have a quick glance at what CKS:DEV is. This will help you understand how different options that we will discuss later on, work and how they could be extended even further.
What is CKS:DEV?
Community Kit for SharePoint: Development Tools Edition, called CKS:DEV for short, is a set of extensions built on top of the framework provided with the new Visual Studio 2010 SharePoint Developer Tools. In the Wave 14, as the release of SharePoint 2010 and Office 2010 is being often referred to, Microsoft has invested in improving the developer experience. As a result we are provided with not only a great set of SharePoint tools, but also a platform that allows us to create new tools that fully integrate with Visual Studio 2010. In fact all standard tools that Microsoft provided us with out of the box, are extensions themselves, proof that the framework really works.
CKS:DEV is a set of extensions for the new Visual Studio 2010 SharePoint Developer Tools. Taking into account both SharePoint Foundation 2010 and SharePoint Server 2010, there are also two versions of CKS:DEV, so you can use it for virtually any kind of SharePoint 2010 project that you’re working on.
What’s in the box?
Extensions provided with CKS:DEV can be divided into four core areas: Environment, Exploration, Content and Deployment. Enhancements to the Visual Studio environment include the new SharePoint References tab available on the Add Reference dialog, allowing you to easily reference any SharePoint assembly without searching the file system or GAC for it. Exploration extends the new SharePoint Explorer with advanced information about SharePoint sites such as the installed Web Parts and Master Pages or the Feature dependencies and elements. Also included in the Explorer are a variety of import functions to bring existing SharePoint items into your active solution. The Content area includes advanced templates such as Linq to SharePoint, Custom Action or Delegate Control. Templates include the SharePoint Full Trust Proxy and the SharePoint Console Application. The enhanced Deployment functions give you the ability to utilize quick deployment and almost a dozen other productivity enhancing deployment steps, including automated deployment (per file on change deployment).
For the complete overview of all the CKS Development Tools Edition features go to the CKS:DEV project CodePlex site at http://cksdev.codeplex.com
Getting productive with CKS:DEV
Now you know what CKS:DEV is, let’s have a look how it can help you getting more productive while developing Web Content Management solutions on the SharePoint 2010 platform. For the purpose of this article we will use a demo Solution called CKSDEV.com site, which is an Internet-facing website that provides the details about the CKS:DEV extensions, the project team, etc.
Creating Site Columns and Content Types
Probably the very first step of every WCM solution on the SharePoint platform is creating custom Site Columns and Content Types. In this step of the development process you’re laying out the foundation for storing information on your website. There are many approaches to creating Site Columns and Content Types and including them in your Solution. If you are a CAML wizard, you might consider doing it all manually and create all Site Columns and Content Types definition manually. On the other hand, if you are a lazy developer, you might be using some kind of tool which would allow you to peek into SharePoint and get all the information that you need in order to create the Site Columns and Content Types, but still you would semi-manually wrap it all up in SharePoint assets. If you are a productive developer however, you might want to keep reading…
On the CKSDEV.com we want to be able to store press releases, information about the team members and we want to be able to create some general pages. To be able to do this we will be provisioning the following Content Types:
- CKSDEV Page
- CKSDEV Press Release
- CKSDEV Team Member
Additionally we will need the following custom Site Columns which will be used by our Content Types:
Since at the moment there is no Site Columns and Content Types designer available in Visual Studio 2010, probably the easiest and the fastest way to configure the Site Columns and Content Types is using the SharePoint Web UI.
Now everything is in place, it’s time to start using Visual Studio.
Visual Studio 2010 SharePoint Developer Tools allow you to browse the Content Types available within your site. CKS:DEV extends this capability with grouped view of Content Types (similar to what you see in SharePoint) and the ability to import Content Types but also complete Content Types Groups into your SharePoint Project. Additionally CKS:DEV allows you to browse Site Columns available within the site together with the ability of importing them into your project.
So instead of manually creating Site Columns and Content Types let’s get productive with CKS:DEV. First let’s import the Site Columns. You can do this by opening the site in the Server Explorer and navigating to the Site Columns node. Then you can import the Site Columns by clicking right mouse button on the CKSDEV.com Columns group and choosing Import from the menu.
You can import the CKSDEV.com Content Types using the same approach. As you can see all Site Columns and Content Types have been imported with just a few mouse clicks and not a single line of XML.
Creating Master Page and Page Layouts for CKSDEV.com Content Types
Once the custom Content Types have been designed we can proceed to the next step which is creating Master Page and Page Layouts. CKS:DEV has two surprises for us here.
Did you know that you can create your custom Master Page with CKS:DEV in a matter of minutes? Usually you would add a new file to your project, copy the content of the Master Page from an existing Master Page and after you’d removed everything that doesn’t belong there, and you would manually configure the packaging and deployment of the Master Page. CKS:DEV ships with a new SharePoint Project Item Template called Starter Master Page that contains everything that’s necessary for you to create a custom Master Page, including the packaging and deployment. The only thing left for you is to copy & paste the HTML from your branding and you’re done!
Once the Master Page is done let’s proceed with creating Page Layouts for our pages.
Creating Page Layouts in SharePoint 2007 was a tedious process. This had partly to do with the fact that probably the only reasonable way to do it was using SharePoint Designer. Because SharePoint Designer understands SharePoint Content Types it allows you to drag and drop all the field controls associated with the underlying Content Type, which is better than guessing the types yourself and typing it all manually. Unfortunately SharePoint Designer 2007 had this notion of knowing better than you what kind of markup you needed and often you ended up with something else than what you meant… While SharePoint Designer 2010 has been improved a lot, CKS:DEV presents you an even better way of creating Page Layouts.
CKS:DEV allows you to generate a Page Layout for every Publishing Content Type. You can generate a Page Layout by selecting a Content Type in the Server Explorer, clicking right mouse button on it and choosing Create Page Layout from the menu. Using the information about the Content Type, CKS:DEV will generate a Page Layout for you. Great thing about the generated Page Layout is that it contains both display and edit controls for all Columns associated with the given Content Type so the only thing left for you is to remove controls that you don’t need and add the HTML markup with your branding!
Quick editing of assets
CKS:DEV supports editing of a few kinds of files. Using the Server Explorer you can edit files deployed to the Master Page Gallery, Style Library and Web Part Gallery. CKS:DEV allows you not only to edit files located in those Document Libraries but also to perform common actions like Check Out, Check In, etc.
Allowing you to edit files deployed to your SharePoint site, makes it easier for you to make quick changes and see their results in SharePoint, and all that from a single application: Visual Studio 2010.
Importing configured Publishing Pages
One of the great capabilities of SharePoint is its ability to benefit of structured and repeatable deployment. When working on a custom solution you could wrap all the components in a SharePoint Solution and hand it over to the customer. Upon installation they would end up with a box of building blocks to assemble the solution. While this is an option, it is definitely a better idea to package your configuration together with your assets. Instead of providing your customer with a set of building blocks, it allows you to provision the fully configured solution with everything on the right place. This approach allows you to simplify the deployment and configuration process and to make it more predictable. And this is exactly where CKS:DEV gets very useful.
WCM solutions contain many preconfigured pages like the home page, some overview pages, etc. where all Web Parts have been put in the right place and configured. CKS:DEV allows you to export such pages to XML so that you can include them in your project for easy deployment! To export a preconfigured Publishing Page go to Server Explorer, find the page that you want to export, click right mouse button on it and choose Export. The configuration of the Publishing Page will get exported to Visual Studio where you are able to edit it and add to your project.
In order to provision a Publishing Page declaratively using a Feature you need a Template Page. While you can find one in the SharePoint Root, you can also make CKS:DEV generate one for you. To generate a Template Page click right mouse button on a Publishing Page and choose Get Template Page from the menu.
One of the most frequently performed tasks during the development process is verifying if everything that you’ve just done works correctly. In terms of SharePoint it means deploying the SharePoint Solution which contains your assemblies and assets. The deployment process of SharePoint Solutions is pretty complex and consumes considerable amounts of time compared to ASP.NET development where you can make a change to your page or control, hit F5 and you can immediately see the results in your browser. Microsoft has done some great work optimizing the packaging and deployment process and bringing in the F5 experience to SharePoint in the Wave 14. And although the new Visual Studio 2010 SharePoint Developer Tools are of great help, frequently verifying your changes takes still way too much time.
One of the capabilities of CKS:DEV is the ability to perform quick deploy of your changes to SharePoint. Using CKS:DEV you can quickly copy the modified files to SharePoint without performing the complete build process. CKS:DEV gives you three quick deployment options: one for quickly copying changed assets to SharePoint Root and one for copying assemblies to GAC/BIN and to copy both assets and assemblies. To perform quick deployment of your changes, click right mouse button on the project and choose Quick Deploy (CKSDEV) from the project context menu.
On top of the on-demand quick deployment, CKS:DEV offers you automatic quick deployment, so that each time you change anything in your project, CKS:DEV will automatically copy the changed files. This is a great win in terms of productivity as it allows you to focus on your work and not think about the deployment at all! Enabling automatic quick deployment is a per project settings. To enable it, select your project in the Solution Explorer, open the Properties window and configure the Auto Copy options.
CKS:DEV is a great asset in the SharePoint developer’s toolbox. Being fully integrated with the new Visual Studio 2010 SharePoint Developer Tools it makes it easier for you to develop SharePoint 2010 solutions. By automating many common tasks that SharePoint developers do every day, it helps you get very productive and allows you to focus on the real work instead the routine process of packaging and deploying SharePoint assets.
CKS:DEV is a free, open source, community-driven product. This article presents only a few of the new capabilities that CKS:DEV offers to SharePoint developers that can be used while working on Web Content Management Solutions but CKS:DEV contains other extensions as well. New capabilities are continuously being added to CKS:DEV based on the community feedback. That really makes it a toolkit built by SharePoint developer for SharePoint developers.