Attach a Sitecore Rocks Connection to a Visual Studio Project

This blog post describes how to link Sitecore Rocks connection to a Visual Studio project using the Sitecore ASP.NET CMS. For more information about Sitecore Rocks, see my blog post Introducing Sitecore Rocks.

As I mentioned in my blog post Sitecore Rocks Connections, Sitecore Rocks connections "are not part of Visual Studio projects or solutions". While that might be techincally accurate, it is actually possible and recommended (but not mandatory) to link a Sitecore Rocks connection to Visual Studio project. As you can guess from the notes below, multiple Sitecore projects can share a Sitecore Rocks connection. So far, it appears to me that the primary benefit is synchronizing files and items as described briefly below.

To link a Sitecore Rocks connection to a Visual Studio project:

  1. In Visual Studio, create the Sitecore Rocks connection. For more information about Sitecore Rocks connections, see my blog post Sitecore Rocks Connections.
  2. Create the Visual Studio project. For instructions to create a Visual Studio project for a Sitecore solution, see my blog post Create a Visual Studio 2010 Project for a Sitecore Solution.
  3. In Visual Studio Solution Explorer, right-click the Sitecore project, then click Sitecore, and then click Connect. The Project Settings dialog appears (see below).
  4. In the Project Settings dialog, in the Connections field, select the connection created previously. The Project Settings dialog copies properties from the existing connection to create a new connection associated with the project. You can click Test if you want, and then click OK.

Screen capture of Project Settings dialog associating a Sitecore Rocks connection with a Sitecore project

Assuming a C# project, linking a Sitecore Rocks connection to a Visual Studio project creates a .csproj.sitecore file in the same subdirectory as the existing .csproj file. The .csproj.sitecore file maintains information about the connection and a mapping between files and definition items.

In Visual Studio Solution Explorer, if you right-click the project after linking it to a connection, the Sitecore menu contains additional entries such as to disconnect or update the Sitecore Rocks connection.

More importantly, when you use Visual Studio to create a resource that involves both a file and a definition item (such as a layout, sublayout, or XSL rendering), Sitecore prompts for confirmation to create the corresponding definition item:

If Visual Studio may prompt you to trust the template, click Trust:

Screen capture of Sitecore Rocks prompting whether to trust an item template

If you rename the file using Visual Studio, Sitecore updates the Path field in the definition item (but does not rename the definition item).

I hadn't set this as a goal, but accounting for over 30 reposts from around November of 2010, this appears to be about my hundredth blog post since moving my blog to last year. For the full archive, see

  • Congratulations on your 100th blog post - Sitecore is very lucky to have you on board. Keep up the good work:-)

  • Hi John   I am not able to see the local IIS sites in the Sitecore explorer. is there any chance you can help me ?

  • Hi there. Have you been able to successfully add a new site connection through the Sitecore explorer window. A local Sitecore instance should appear under the "connections" node after the connection is set up.  If you are referring to the <Local IIS Sites> node in the Sitecore explorer then I don't think it is necessary. Sitecore instances should usually be listed under the "connections" node instead of the  "<Local IIS Sites>" node.

  • Hi Scott,   Many many thanks for your quick response, yes I have managed to connect to the instance i have and then moved the server into lodal IIS sites ;)   Thanks Jawad

  • Hi  In Windows 8 and later, the IIS has been locked down and can only be access by an administrator. This means that if you run Visual Studio as a non-administrator the <Local IIS Sites> does not appear.  Unfortunately accessing IIS without being an administrator crashes the application. To have the <Local IIS Sites> appear in the Sitecore Explorer you need to both run VS as administator and set Tools | Options | Sitecore | Options | Disable IIS Integration to False.