My Learnings of using Sitecore Development Toolkit

Dear Sitecore Family,

Today’s post is about my experience of working with Sitecore Development Toolkit.

Firstly, Thank you Alen Pelin for a nice simple yet powerful tool, for syncing the Sitecore Items between different Developer Boxes as well as different environments.

Yes, I agree that TDS is by far the best tool for Item Sync, but there are other good options available too, like Sitecore Development Toolkit and Unicorn, which are developed by Sitecore Enthusiasts and the main benefit is they are free to use for the Sitecore Community.

Note: This post is about sharing my experience of using Sitecore Development Toolkit and nothing more.


  • SDT is FREE and is available on Sitecore Marketplace for the Sitecore Community to use.
  • SDT is hooked with various item state events – Saved, Moving, Moved, Renamed, Deleting – and based on these, it serializes the items on disk.
  • We can commit the serialized .item files and their corresponding folders into our repository, and take full advantage of versioning and revision control system (SVN, TFS, GIT, etc).
  • When Sitecore starts, SDT deserializes all the Serialized items. So, to add item changes of different developers of our team to our local development environment, after taking the latest build, we simply need to recycle the application pool of the Sitecore application so that our Local box is updated. So no human intervention is required to apply item changes of other developers to our local database.


  • The serialized items are not managed as a project, the way they are in TDS, and it becomes a little difficult to work with them as individual files. Often times, we might want to add the folder to our Visual Studio solution, to manage these files and commit in our repository rather than an individual folder or directory.
  • On Multiple saves for an item, the same item is saved as different revision numbers and sometimes the item changes are lost if someone in the team forgets to commit all the serialized files – i.e. the ones with different revision numbers.
  • If two developers are working on the same item, the revision IDs of the item will be different in both the developers and there is a strong possibility that we overwrite the item changes of the other developers.
  • The last point in Pros can also be considered in Cons, say we take the latest build and see only CSS changes are available and move ahead without recycling the application pool, the item of other developers will be overwritten by us on performing different activities like – Save, Rename, etc.
  • In case we configure SDT in the midst of an ongoing project, then we cannot directly have the items serialized. We need to fire some action – say save or rename to get all the required items serialized on disk.

Have you used SDT or any other Free Item Sync Tool? Do you have any other learnings? Yes?

Well, then please share, because Sharing is Caring!

Happy Sitecoring! :)

Create TDS Package with only specific Sitecore Items

Dear Sitecore Family,

How are you all doing? Sincere Apologies for being away from the blog for quite sometime. I was busy with a number of things along with working on a few of my personal projects on Raspberry PI.

Well, the only thing that I can say right now is:


Lets talk a little bit about today’s post. A couple of days back, I had a discussion with a few Sitecore developers regarding a challenge that they were facing. They wanted to create a package using TDS, but only for some items, say for the ones which are created and committed in a given Sprint. So lets discuss it.


Can we have only specific items in a TDS Package rather than having all the synced items?


I am sure you know that we can create a Sitecore Update Package using TDS. For those who don’t here’s check this to know the configurations that we need to do for enabling it.

As we all know TDS is a great tool and after getting the ease of its use as well as the features that it provides, our gut feeling says there has to be some way of getting it done.

And the answer of the above, is YES! It can be done, using the “Exclude Item From” property and selecting the Visual Studio Solution configuration, from where we want to exclude it.

Lets see how can we do it.

These are the Build Settings that we do in our TDS Project:


And these are the Update Package Settings we do in our TDS Project:


Now, lets create some items in our Sitecore Solution.


Lets sync these items with our TDS Project.


Now, when we build, based on the Solution Configuration that we have set in our Visual Studio, a directory is created in our project directory.



In here, is the update package created. To check its contents, we can rename it to .zip from .update and open it like any other zip file and check.


Now, say this is Package 1 – which we have created and installed on all the required environments. In the next package, we don’t want these items to be packaged. Say we created new items only under the Base Item and dont want Page-Items item to be packaged. So here’s what we do.


After the items are synced, Set the “Exclude Items From” property in the item/s which we don’t want to be included in the Sitecore Package.


Now, when we build and check the Sitecore Package, we will be able to find, that the Page-Items Item will not be present in the Package.



Hope you enjoyed the post!

Happy Sitecoring! :)

Page Editor Experience – Set the Datasource Template for the Presentation Component

Dear Sitecore Family,

Yesterday, we saw how selecting a Datasource Location helps the Business User.

Today, lets take it a little further, lets see if we can do something so that the Business User is not confused between selecting the type of Datasource Item for a component, if there are a number of components available at the specified Datasource Location.


Can we make the Business User journey easier while working with Sitecore by specifying the Type of Item that is expected as a Datasource Item by the Presentation Component?


Again, the answer is Yes! Thank you Sitecore!

Oh, you want to know how can this be done?

Well, lets check that out.

Quoting an example from the Launch Sitecore 8 Demo Site and again considering the Carousel Component. In every Presentation Component – whether a Rendering or a Sublayout, there is an item field called Datasource Template. [Note: Sitecore as already provided the value for this field in Launch Sitecore site, I have removed it for our understanding purpose, of how things work when this field value is not specified at first and then specified later.]

We will make use of this field, to specify the Type of Datasource expected by the component.


By default, for any Presentation Component, this field is empty. So, whenever the Business User tries to set the Datasource from Page Editor, this is what he/she will see.



See that, the Business User can select any item as a Datasource.

Now, lets check what happens when we set the Datasource Template, for the Rendering.



And now checking the Select Associated Content dialog from Page Editor.



Oh Wow!

So this is what happens. Sitecore Validates the item that is selected as a Datasource and if the Datasource Item is not of the Template specified above, it cannot be added as a Datasource.

At the same time, Sitecore gives us a nice validation message for the understanding purpose.

Simple and Useful right?

Hope you enjoyed the post!

Happy Sitecoring! :)

Page Editor Experience – Select the Datasource Location in a Presentation Component

Dear Sitecore Family,

How you been? Hope you are enjoying these posts on Sitecore Page Editor a.k.a Sitecore Experience Editor?

Today, lets discuss about making the Business User journey smoother with Sitecore, while working with their own Website.


When the properties Dialog opens and the Business User clicks on the Datasource, he/she is kind of lost in the Sitecore Content Tree. Can there be a way to get to the specific content?


Well, the answer is yes, as it is Sitecore!

How do we get it done?

Lets take an example of Launch Sitecore Site to understand the scenario. Currently considering the Carousel Rendering. In every presentation component, we have a field called Datasource Location

By default, its empty. So whenever we go to the Page Editor and try adding the Datasource, we get the Content Tree starting with Content.


Now, lets add a Datasource Location and see what happens.

As Sitecore has done, lets add the following Location as a Datasource:


of the field Datasource Location in Carousel


Now, whenever we go to the Page Editor and open the Properties Window or Set Associated content for the Carousel Component, it directly opens as follows:

When-Datasource-is-assignedVery useful right? Our Business Users don’t need to go and search for the Datasource in the whole content tree.

Hope you found the post useful!

Happy Sitecoring! :)

Page Editor Experience – Select Associated Content after adding a Presentation Component on Page

Dear Sitecore Family,

A very small yet useful post today.

Sometime back, we saw how to add a Component with a DataSource. In case you missed it, here’s how we do it.

When we add a presentation Component from Page Editor which requires a Datasource, we need to go and Set associated content for it.


Now, for a Business user, its difficult to know that he or she needs to select a Datasource, in case we have some good documentation for it, then its ok. So it becomes the responsibility of the developer, to make things easy for the Business User.


How do we  make things easy for the Page Editor User/Business User?


While creating the Sublayout, we are provided with an option as shown below:

Open-Properties-after-AddBy default, the value is “Default” which means No — Let’s make it Yes from the DropDown


After this, whenever the Business User tries to add that particular component onto the page, he/she will find the checkbox to be disabled.


And, on adding it on the page, the Properties Dialog will open immediately,


which in a way, notifies the Business User that some action needs to be taken — Add a Datasource.


Hope you liked the post!

Happy Sitecoring! :)

Setup Visual Studio Project with Post Build Script

Dear Sitecore Family,

This post is in continuation to the post Setup Sitecore Developer Box in less than 5 minutes.

Here, we will discuss another way of Setting up the Visual Studio project in such a way that we do not need to use Visual Studio Publish .


A Developer needs to Publish the Changes everytime he/she wants to sync it with the Sitecore Website. For some, this can be a useful point – say someone who builds the visual studio solution on a regular basis just to check that things are doing fine till that time, but doesn’t want the Sitecore Website to restart everytime, this would be an ideal scenario. At some point of time, even I do it that way, I just build to check hope there is no build error or warning till that point of time, but as there are some more things left to code, I don’t want to merge them to my Sitecore Website and unnecessary restart it.

But in case when I want to sync the changes to the Sitecore Website, I need to go and say “Publish” to my Visual Studio solution — indeed a step more, which we can save.

On discussing this with Mr. Brijesh PatelTech-It Pro Author, he told me, why do I require do an additional step everytime? And then even I felt what he said, had an important point!


He asked me Varun, remember some Build related events? Yes, it is the Post-Build Event which is of our concern!

Then, we went and configured the Post Build Event in a project and it worked like charm! Here’s how we did it.


  1. After Step 2 of the Previous Post, go to the Directory Structure of the Visual Studio Solution and open the main Web Project File (.csproj) — in Notepad or Notepad++.
  2. Go to the End of File, and we will see a commented section – after ProjectExtensions.
     <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    Other similar extension points exist, see Microsoft.Common.targets.
    <Target Name="BeforeBuild">
    <Target Name="AfterBuild">
  3. Uncomment the Target with name “AfterBuild” and add a few lines of configuration to it. Basically, we will add a few lines into the ItemGroup Section inside AfterBuild, and then we will add the Copy Tag to specify where should the specified files be copied! Here’s how we would do it.
      <Target Name="AfterBuild">
    <MyBinDllFiles Include="$(ProjectDir)\bin\**\*.*" />
    <MyConfigFiles Include="$(ProjectDir)\App_Config\Include\**\*.config" />
    <MyImageFiles Include="$(ProjectDir)\VisualStudioSampleProject\StaticResources\Images\**\*.*" />
    <MyFontFiles Include="$(ProjectDir)\VisualStudioSampleProject\StaticResources\Fonts\**\*.*" />
    <MyStyleFiles Include="$(ProjectDir)\VisualStudioSampleProject\StaticResources\Styles\**\*.css" />
    <MyScriptsFiles Include="$(ProjectDir)\VisualStudioSampleProject\StaticResources\Scripts\**\*.*" />
    <MyLayoutFiles Include="$(ProjectDir)\VisualStudioSampleProject\Layouts\**\*.aspx" />
    <MySubLayoutFiles Include="$(ProjectDir)\VisualStudioSampleProject\Sublayouts\**\*.ascx" />
    <Copy SourceFiles="@(MyBinDllFiles)" DestinationFiles="@(MyBinDllFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\bin\%(Filename)%(Extension)')">
    <Copy SourceFiles="@(MyConfigFiles)" DestinationFiles="@(MyConfigFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\App_Config\Include\%(RecursiveDir)%(Filename)%(Extension)')">
    <Copy SourceFiles="@(MyImageFiles)" DestinationFiles="@(MyImageFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\VisualStudioSampleProject\StaticResources\Images\%(RecursiveDir)%(Filename)%(Extension)') ">
    <Copy SourceFiles="@(MyFontFiles)" DestinationFiles="@(MyFontFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\VisualStudioSampleProject\StaticResources\Fonts\%(RecursiveDir)%(Filename)%(Extension)')">
    <Copy SourceFiles="@(MyStyleFiles)" DestinationFiles="@(MyStyleFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\VisualStudioSampleProject\StaticResources\Styles\%(RecursiveDir)%(Filename)%(Extension)')">
    <Copy SourceFiles="@(MyScriptsFiles)" DestinationFiles="@(MyScriptsFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\VisualStudioSampleProject\StaticResources\Scripts\%(RecursiveDir)%(Filename)%(Extension)')">
    <Copy SourceFiles="@(MyLayoutFiles)" DestinationFiles="@(MyLayoutFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\VisualStudioSampleProject\Layouts\%(RecursiveDir)%(Filename)%(Extension)')">
    <Copy SourceFiles="@(MySubLayoutFiles)" DestinationFiles="@(MySubLayoutFiles->'C:\Websites\Sitecore\SitecoreSolution\Website\VisualStudioSampleProject\Sublayouts\%(RecursiveDir)%(Filename)%(Extension)')">
  4. Go to Visual Studio with the Project open – it will ask to Reload the Web Project as it has undergone some changes, say yes and we are done!
  5. Make some changes and say Build Solution – and our changes are visible in the Sitecore Website!


In a Developer Box, it is always useful to configure the Post-Build Event rather than using the Visual Studio Publish for merging changes with the Sitecore Website, as suggested in Step 3 of the previous post! This is to avoid performing an additional step everytime we need to sync the changes! And as far as saving code changes on a regular basis, we can anytime use Ctrl+Shift+S — to save all the changed files.

The Step 3 – of Visual Studio publish is good when we want to deploy the Project changes to Sitecore Website on different environments, say we are merging the changes from our Local Box to the Internal Integration Testing Environment or the UAT Server.

Hope you enjoyed the post!

Happy Sitecoring! :)

Page Editor Experience – Fetch the Datasource in code of a Presentation Component

Dear Sitecore Family,

In the previous 2 posts, we just saw how to configure a Datasource in a  Presentation Component and Adding a Component from Page Editor.

The previous posts are not of any specific use, if we don’t see how do we retrieve it in code and how do we display it!

So lets just have a look at it.

Well the first thing, as we all know, its always good to use the DRY Rule of Software Engineering!

Step-1: So instead of writing a big piece of code to fetch the Datasource, its good to use the Sitecore Module Sublayout Parameter Helper by John West.

Step-2: We change the inheritance of the Sublayout Component – we change it from System.Web.UI.UserControl to Sublayoutbase as follows:


public partial class SublayoutDatasourceSample : System.Web.UI.UserControl


public partial class SublayoutDatasourceSample : SublayoutBase

Step-3: After the above step, when we build our solution and check for DataSourceItem in our Sublayout Page_Load function code, its available — this is a property visible from the SublayoutBase class!


So we just apply a couple of required validations and next is assign it as the Item for the various fields we have created.

Say, I add a couple of FieldRenderers in the ascx code,

<sc:FieldRenderer runat="server" ID="Header" FieldName="Heading" />

<sc:FieldRenderer runat="server" ID="Content" FieldName="Content" />

And using the DataSourceItem property, I assign the Item to these two controls as follows:

public partial class SublayoutDatasourceSample : SublayoutBase
protected void Page_Load(object sender, EventArgs e)
Header.Item = DataSourceItem;
Content.Item = DataSourceItem;

And the work is done!

So we see, how easy it gets when we are aware of the things that are already available and how to use them.

Thank you John West for this Awesome Module, it definitely saves us from a lot of repetition of code in various Sitecore Projects!

Happy Sitecoring!