Abstract

Word on the street has it that Developer Center functionality in Sitecore 7+ is deprecated and will eventually become obsolete. A Visual Studio Add-on called Sitecore Rocks will replace this functionality. This add-on brings most of the Content Management Developer functionality directly into Visual Studio. If you haven't used Sitecore Rocks before, now is the time to start.

This is the first of a series of posts focused on utilizing Sitecore Rocks within your Sitecore development efforts.

Overview

The majority of Sitecore Developers have become accustomed to switching between the browser and Visual Studio when developing Sitecore solutions. Some pioneers were early adopters to a great Visual Studio add-on called Sitecore Rocks and have gained developer efficiencies from its use. The rest of us have continued to work within our comfort zone switching between the browser and the IDE. It's time to get out of our comfort zone though and embrace some Sitecore Rocks goodness.

Top 5 Reasons to Use Sitecore Rocks

  1. Minimize switching between Browser and Visual Studio
  2. May replace Developer Center in future release of Sitecore
  3. You will generate envy among your peers
  4. Your hair will grow longer (if shorter) or simply grow (if you're like me)
  5. Shorter times for most developer-centric tasks

While 3 and 4 are not necessarily guaranteed by Jakob Christensen, the developer for Sitecore Rocks (and available on Twitter at twitter:@TheRocksGuy); 1, 2 and 5 are absolutely achievable. Sitecore Rocks, through the use of its Hard Rock Web Service, interacts with Sitecore's data tier and provides thick client responses to what are typically slower browser interactions. I'm not saying that Sitecore's Content Editor is slow, only that Sitecore Rocks is faster. If you work with Sitecore on a regular basis as a developer then Sitecore Rocks is a must have tool in your tool bag. Read on if you're new to Sitecore Rocks and if you have a Sitecore sandbox to play in, I urge you to install it and start using it today.

Installation

To add Sitecore Rocks to your IDE and get started, you need to have at least Visual Studio Professional edition. Web Express edition does not [currently] allow extensions. You have 2 options to add Sitecore Rocks. Option 1 is through the Extensions and Updates option under the Tools menu. The second option is to download it from here. Once installed, Sitecore Rocks will add a Sitecore menu to your IDE. From there you can choose Connect.

I prefer to use the Hard Rock Web Service (although this requires your Sitecore instance to be modified to accept connections from this web service) for performance reasons. Next, you'll need to enter your host name and your administrator user name and password and click OK. Sitecore Rocks will automatically update your Sitecore instance to use the Hard Rock Service. Next, on the Sitecore menu choose "Sitecore Explorer". You should now see your connection listed. If you expand that connection you'll see your Master, Web and Core databases listed.

Using Sitecore Rocks

Query Builder

As I mentioned earlier, Developer Center will likely get removed from Sitecore in the future. The only tool I use from the Dev Center is the Query Builder tool. Not to worry though! Sitecore Rocks has it built in. As an example, right-click on the Master database icon, choose Tools and then choose XPath Builder. You should now see this screen:

As an example, let's do a search for all items with the Template Name "Image". In Sitecore 7.1 vanilla install, you should get a result list that includes the simulator images.

Sitecore Renderings

Adding Layouts and Sub Layouts that have code-behinds to Sitecore without Sitecore Rocks can be accomplished one of two ways. The first is to add the component to Sitecore through the browser. When complete, you'll have your component reference tied to its file on the file system. In the file system, you get your markup file and your code behind but no designer partial class file. You then have to run "Convert to Web Application" to get the designer file added for you. The second option is to create the component in your Visual Studio solution then go to Sitecore and backfill the content item. The second option is challenging since Layouts and Sub Layouts have special handling that creates the files.

With Sitecore Rocks, you can now just stay in Visual Studio. Follow your normal pattern for adding a sub layout in Visual Studio. In this case I created "Sample Sublayout.ascx".

Visual Studio automatically adds my code-behind and my designer partial class file. Second, right click on the item you added and look for the "Sitecore" content menu option. If the option is disabled, you'll need to right click on your Web project first and choose "Connect" from the Sitecore content menu option. You'll get a Connection window that should have your connection in it that you've already created. Choose the connection and click OK.

Move back to your sub layout, right click on it and from the Sitecore context menu choose "Create Items from File". You'll see a screen similar to this one:

If you have a special folder dedicated to your solution's custom sub layouts, choose it in the tree above and then click "OK". Your file system and Sitecore are now in Synch.

Summary

If you haven't been using Sitecore Rocks to date, you need to start. The efficiencies gained from using it and being able to stay in Visual Studio longer are significant. Let me know what your experiences are if you have any setup problems and I'll be happy to help. With this tool, you'll find your Sitecore Developer Experience vastly improved!